Skip to content

feat(ifc): a port joined to a placed duct or pipe port is placed at the same point, with its axis (#869) - #922

Merged
DrunkOnJava merged 8 commits into
mainfrom
fix/869-joined-ports
Oct 23, 2026
Merged

DrunkOnJava merged 8 commits into
mainfrom
fix/869-joined-ports

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

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 IfcDistributionPort has 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, each PortConnection gives 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) and docs/support-matrix.json (row element-record-mep-connections, still partial) carry the measurement.

Measured

Measure run 39980923263, head against main, port_places_vs_ifc:

Model Ports joined to a segment's port Base: placed Head: within 0.01 ft of Revit's Head: Z axis as Revit's / opposite
RE1 Plumbing 118 0 118 51 / 67
RE1 Mechanical 59 0 59 26 / 33

The axes follow the segment port's axis. rvt-rs's segment ports are themselves opposite to Revit's on Revit's In ports, 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

  • I agree this work is licensable under Apache-2.0
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content. Clean-room declaration: the rule was derived only from Revit's public IFC exports of the MIT-licensed RE1 models and rvt-rs's own reads of the .rvt files.

…oined to a segment's port (#869)

(cherry picked from commit 2b5d1c0)
…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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/support-matrix.json Resolved
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 23, 2026 16:09
@DrunkOnJava
DrunkOnJava merged commit 7b274d2 into main Oct 23, 2026
27 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/869-joined-ports branch October 23, 2026 19:36
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`.
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant