Skip to content

feat(ifc): a pipe's ports are placed at the end their connector entry keys name, along the pipe (#847) - #865

Merged
DrunkOnJava merged 11 commits into
mainfrom
fix/847-pipe-port-places
Oct 20, 2026
Merged

DrunkOnJava merged 11 commits into
mainfrom
fix/847-pipe-port-places

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #847 for pipes. rvt-rs wrote every IfcDistributionPort with no placement. Revit's export places each port at its connector, relative to its element's placement, with its Z axis along the pipe.

  • partition_pipe_axes::scan_pipe_end_keys reads, in one pass over each pipe partition, the keys of the connector entries at each end of each pipe: the element at that end and its connector index (RE-131's layout). attach_pipe_axes stores them as m_pipe_start_keys / m_pipe_end_keys.
  • The exporter places a pipe's port i at the one end whose keys name connector i. A key names it when it is the pipe itself with index i, or the element and connector that pipe connector i is joined to in either element's join list (RE-138). A port that no end names, or that both ends name, keeps no placement.
  • IfcEntity::Port gains location_feet and direction. The STEP writer gives such a port an IfcLocalPlacement in its pipe's frame, with its Z axis pointing out of the pipe, or into it for a SINK port.
  • Ducts are not placed: rvt-rs draws them other than along Revit's axis, so their ends are not read. Nor are family-instance connectors, which are placed in their family's coordinates (IfcDistributionPort has no placement: Revit's export places each port at its connector #847's second point).

Measured (research branch re/847-port-places)

Verification

@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: 8db14a6930

ℹ️ 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 src/ifc/export_content.rs Resolved
… keys name (#847)

partition_pipe_axes::scan_pipe_end_keys reads, in one pass over each pipe partition, the keys (element, connector index) of the connector entries at each end of each pipe, and attach_pipe_axes stores them as m_pipe_start_keys / m_pipe_end_keys. A pipe's port index is at the one end whose keys name it: the pipe itself with that index, or the element and connector the pipe's index is joined to in its or the other element's join list (RE-138). IfcEntity::Port gains location_feet, and the STEP writer gives such a port an IfcLocalPlacement in its pipe's frame; a port no end names keeps none. On the RE1 models every pipe end with a port in Revit's export is named by its keys (Measure run 39370306743: 57 of 57 self keys, 168 of 168 joined keys).
… rvt-rs's pipes, by connector index (#847)

(cherry picked from commit 3808cca)
…o it for a SINK port, as Revit's export writes them (#847)

Revit's ports on the RE1 pipes point their Z axis into the pipe for an In port (66 of 66), out of it for an Out port (65 of 65) and out of it for a port with no flow direction (19 of 19), Measure run 39370944258. rvt-rs reads no flow direction for a pipe's ports yet (#834), so they point out of the pipe. The scorer now compares each placed port's Z axis with Revit's.
…n, so a Z axis along -X has an X axis (#847)

IFC's default reference direction is +X, which leaves no X axis for a port pointing along -X; IfcOpenShell's placement divided by zero on RE1's ports (Measure run 39371440417). A port now takes up as its reference direction, or +X where it points up or down.
…gelog says what #847 adds (#847)

strip_building_element_geometry cleared only building elements, so typed-no-geometry kept each placed port's point and axis (Codex on #865); it now clears them too.
@DrunkOnJava
DrunkOnJava force-pushed the fix/847-pipe-port-places branch from 7e9c54b to 4a6e5af Compare October 20, 2026 04:53
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 20, 2026 04:55
@DrunkOnJava
DrunkOnJava merged commit a830245 into main Oct 20, 2026
30 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/847-pipe-port-places branch October 20, 2026 05:32
DrunkOnJava added a commit that referenced this pull request Oct 20, 2026
…, which its connector entry keys name (#847) (#868)

## Summary

Follows #865 for ducts (#847). A duct along one of the model's axes has a record box that is its section by its length (RE-134: 25 of 25 RE1 ducts). Its two ends are the centres of the box's faces across its length.

- `attach_duct_end_keys` gives each such duct those ends (`m_duct_start_*`, `m_duct_end_*`). It then reads the keys of the connector entries there through `scan_pipe_end_keys` (`m_duct_start_keys`, `m_duct_end_keys`). A duct whose box leaves no single length axis gets neither.
- Its ports are placed as #865 places a pipe's: at the one end whose keys name the connector, with the Z axis out of the duct.
- `pipe_end_keys_from_fields` and the new `duct_end_keys_from_fields` share one reader. The pipe pass and the duct pass write their keys through one helper.

## Measured

Measure A/B against main, run [39374659068](https://github.com/DrunkOnJava/rvt-rs/actions/runs/39374659068), on the code of this branch before its rebase onto #865's merge:

- **RE1 Mechanical:** all 62 of the ports Revit writes on flow segments are placed within 0.01 ft of Revit's: the 12 on pipes, as with #865, and the 50 on ducts, which #865 left unplaced. Their Z axis is Revit's on the 26 `Out` ports and the 9 with no flow direction. It is opposite on the 27 `In` ports (#834).
- **RE1 Plumbing:** unchanged from #865, 124 of 124.
- **Validation:** the IfcOpenShell validator and the IFC4 property set check give 0 findings.
- **Other models:** only the two RE1 MEP exports change.
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.

IfcDistributionPort has no placement: Revit's export places each port at its connector

1 participant