Repository navigation
feat(ifc): a port joined to a placed duct or pipe port is placed at the same point, with its axis (#869) - #922
Merged
Merged
Conversation
…he same point, with its axis (#869) Revit's export places every port joined to a flow segment's port at that port's point (RE1: 118 of 118 on Plumbing, 59 of 59 on Mechanical, Measure run 39375641547), with the same Z axis on 108 and 53 of them. The writer now gives an unplaced connector of a join whose other connector is placed that point and axis, in its own element's frame.
…f each port joined to a segment's port (#869)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8977651f2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
DrunkOnJava
enabled auto-merge (squash)
October 23, 2026 16:09
9 of 10 tasks
DrunkOnJava
added a commit
that referenced
this pull request
Oct 24, 2026
…t its connector, through the instance's transform (#869) (#943) ## Summary Each family-instance port that no duct or pipe joins is now placed at its connector. The point and axis come from the connector's entry in the symbol that draws the instance, carried through the instance's transform. On Revit 2025, all 100 such ports on the RE1 MEP models are within 0.01 ft of Revit's export, each with Revit's Z axis: 53 of 53 on Electrical, 29 of 29 on Mechanical and 18 of 18 on Plumbing. None had a placement before. Part of #869. ## Motivation #869: Revit's export places every `IfcDistributionPort` at its connector. rvt-rs placed a pipe's ports at its ends (#847), and from #922 a port joined to a placed duct or pipe port at that port's point, but every other family-instance port had no placement at all. A `FamilySymbol`'s `m_arrConnectorData` entries hold each connector's `m_trf`, which RE-212's probe printed: - `m_or` is the connector's point in the symbol's coordinates; - the third column of `m_3x3` is its Z axis. The axes and origin of RE-87's instance transform carry both into model space. The symbol must be the one that draws the instance, its `InstanceInfo.m_symbolId` (RE-215), not its type. With the type's symbol, the first run (Measure [40116288661](https://github.com/DrunkOnJava/rvt-rs/actions/runs/40116288661)) placed 9 of Plumbing's 18 and 2 of Mechanical's 29 ports elsewhere: - most of Plumbing's by 0.0538 ft; - one of Mechanical's by 0.81 ft. They are on fittings sized per instance, whose symbols are their own. ## Changes - `src/native_connectors.rs`: - `InstancePort` gains `frame: Option<ConnectorFrame>`, the connector's point and Z axis in the symbol that draws the instance; - `connector_ports` reads every `FamilySymbol`'s connector frames and each instance's `InstanceInfo.m_symbolId` in the same pass; - a frame counts only if its point is finite and its axis a unit vector; - `InstancePort` and `ConnectorPorts` drop `Eq`, since they now hold `f64`s. They are research types, outside the stable API. - `src/ifc/mod.rs`: `attach_family_instance_ports` gives each new port that point and axis through the instance's transform (`scan_instance_transforms`). - It is limited to `PORT_PLACEMENT_REVIT_VERSIONS` (2025, the release measured). - A port joined to an already placed port is left to #922's rule. - The writer turns an In port's axis around as it does every port's (#847), and the axes come out as Revit's. - `tools/re/port_places_vs_ifc.py` also scores rvt-rs's placement of Revit's ports on elements other than segments that no segment's port joins. - `docs/support-matrix.json`: - the MEP connections entry says how these ports are placed and what was measured; - it updates the joined ports' axis counts to the ones since RE-212 (108 and 53 as Revit's, 10 and 6 opposite). - `changelog.d/added/unjoined-ports.md` (#938). ## Testing Unit tests are banned in this repository: do not add them. Show the change working end to end on real files instead. - [ ] `tools/check-local.sh` passes: CI runs it. Measure built the head with `--profile ci`, and rustfmt and the let-chain scan pass. - [x] Verified end to end on real Revit files: the command, the files (and their licence), and the measured result against Revit's own export are in the PR body, with the script or probe that reproduces it - Files: RE1 Electrical, Mechanical and Plumbing (Revit 2025, MIT, `Drshelden/IFC-ECS`) with Revit's own IFC exports, fetched by Measure. - Measure [40117533857](https://github.com/DrunkOnJava/rvt-rs/actions/runs/40117533857), this branch against main, `port_places_vs_ifc`: | model | ports no segment's port joins, within 0.01 ft of Revit's | Z axis as Revit's | |---|---:|---:| | RE1 Electrical | 53 of 53 | 53 | | RE1 Mechanical | 29 of 29 | 29 (14 In, 14 Out, 1 other) | | RE1 Plumbing | 18 of 18 | 18 (8 In, 8 Out, 2 other) | - Pipe-end ports (62 and 124) and joined ports (59 and 118) are placed as on main. - The IFC changes on the three RE1 MEP models only, and every other scorer output is identical on all models. - Timing, from the first run, whose two sides ran on the same CPU type: RE1 Electrical 1435 → 1454 ms, Mechanical 758 → 777, Plumbing 697 → 698. In 40117533857 the two sides ran on different CPU types. - [x] If this touches the IFC exporter: the witness verdicts replay. Core Interior's export is unchanged, and so are its observations. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR - [x] If a new limitation was introduced, it is documented. The placement is limited to Revit 2025, and Snowdon Towers' MEP models (2024, local only) are not measured. - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 (see `CONTRIBUTING.md`) - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see `CLEANROOM.md`) - Contributor declaration: the connector frames are read from the corpus files' own records through their `Formats/Latest` schema (RE-212's probe), and checked against Revit's IFC exports. No Autodesk SDK source, disassembly, leaked documents or NDA material was used. ## Breaking changes None in the stable API: `research::native_connectors` is behind `unstable-research`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A port joined to a placed duct or pipe port is placed at that port's point, with its Z axis. This includes a family instance's port, which had no placement before. Revit's export places every port joined to a segment's port at that port's point. Part of #869: family-instance ports joined to anything other than a placed segment port keep no placement.
Motivation
#869: a family instance's
IfcDistributionPorthas no placement, because its connectors are in its family's coordinates. Its joins to segment ports already give the point. On RE1, Revit's export puts every port joined to a segment port at that segment port: 118 of 118 on Plumbing and 59 of 59 on Mechanical. 108 and 53 of them have the segment port's Z axis.Changes
src/ifc/step_writer.rs: before the ports are written, eachPortConnectiongives an unplaced connector its partner's point and axis, when the partner is placed. The writer then expresses it in its own element's frame.tools/re/port_places_vs_ifc.py: scores where Revit's export places a port joined to a segment's port. It now also scores rvt-rs's placement of the same port.CHANGELOG.md(the unreleased IfcDistributionPort has no placement: Revit's export places each port at its connector #847 entry) anddocs/support-matrix.json(rowelement-record-mep-connections, still partial) carry the measurement.Measured
Measure run 39980923263, head against main,
port_places_vs_ifc:The axes follow the segment port's axis. rvt-rs's segment ports are themselves opposite to Revit's on Revit's
Inports, whose flow direction is not read yet (#834), so that error carries over. The points are exact.Every other scorer's output is identical at base and head on all five reference models (Core Interior, RE1 Architecture, Electrical, Mechanical, Plumbing). The IFC changes only on Plumbing and Mechanical.
Audit-honesty checklist
Legal and contribution hygiene
.rvtfiles.