Skip to content

feat(ifc): a family instance written as a proxy has its ports, nested in it (B83) - #705

Merged
DrunkOnJava merged 3 commits into
mainfrom
feat/b83-nested-proxy-ports
Oct 5, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
feat/b83-nested-proxy-ports

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

B83, the remainder of B54 (#528). In Revit's export of RE1 Electrical, 30 of the 53 ports sit on elements that both Revit and rvt-rs write as proxies: panels, receptacles, switches, junction boxes and sensors. RE1 Mechanical has 6 such ports, all on one element (427568). rvt-rs gave ports only to distribution elements, because it ties each port with IfcRelConnectsPortToElement, which IFC4 restricts to distribution elements. Revit's own IFC4 export (revit-ifc ConnectorExporter) uses IfcRelNests instead and nests every port in its element.

  • attach_family_instance_ports now gives a proxy one port per symbol connector, the same way it treats a distribution element (RE-169).
  • The writer nests a proxy's ports in it, with one IfcRelNests per proxy ('NestedPorts', 'Flow', as revit-ifc names it). Every other port keeps its IfcRelConnectsPortToElement.
  • tools/re/ports_vs_ifc.py counts nested ports as tied to their element.

Red/green. tests/proxy_ports.rs failed on draft #704 (Corpus health run 37299353664) with 30 of 30 missing on Electrical and 6 of 6 on Mechanical. The failing output is in the test commit.

Measure (run 37299621824, this branch's scorers on both sides):

model ports before ports now Revit untied schema findings
RE1 Electrical 23 53 53 0 0
RE1 Mechanical 144 150 150 0 0

Only those two models' IFC and port scores change. Their diagnostics change only in total_entities (229 to 259 and 528 to 534). The other 145 outputs are identical.

To follow (B84, which needs the maintainer's approval): nest every port the way Revit's IFC4 export does. That would change how the existing family_instance_ports and duct_and_pipe_ports tests read ties.


Note

Medium Risk
Changes IFC topology for proxy-hosted MEP connectors (new ports and nesting relationships); behavior is scoped to proxies but affects port counts and schema relationships on real corpus models.

Overview
B83 extends connector port export to family instances written as IfcBuildingElementProxy, matching Revit’s IFC4 pattern where IfcRelConnectsPortToElement is not valid for proxies.

Export model: attach_family_instance_ports now attaches symbol connector ports to proxies the same way it does for distribution elements, so electrical/mechanical fixtures (panels, receptacles, etc.) get the ports Revit’s reference IFC expects.

STEP writer: Ports on proxy hosts are grouped and linked with IfcRelNests (NestedPorts / Flow) instead of IfcRelConnectsPortToElement; distribution elements keep the existing port-to-element relationships. Join IfcRelConnectsPorts behavior is unchanged.

Validation: New corpus test proxy_ports compares nested proxy ports against Revit’s RE1-*.ifc; CI includes real proxy_ports. Research scorer ports_vs_ifc.py treats IfcRelNests as the port-to-element tie for proxies.

Reviewed by Cursor Bugbot for commit f8d28c3. Configure here.

…ests them (B83)

Revit's export of RE1 Electrical writes 30 of its 53 ports on elements both
it and rvt-rs write as proxies. IFC4 ties a port to a distribution element
only through IfcRelConnectsPortToElement, and Revit's own IFC4 export
nests every port in its element with an IfcRelNests. For every port Revit
writes on an element rvt-rs writes as an IfcBuildingElementProxy, rvt-rs
must write the port Port_<ElementId>_<index>, nested in that element.

Red on draft #704, Corpus health run 37299353664:

    RE1-Electrical.rvt: 0 of Revit's 30 ports on proxies written, nested in their element
    RE1-Plumbing.rvt: 0 of Revit's 0 ports on proxies written, nested in their element
    RE1-Mechanical.rvt: 0 of Revit's 6 ports on proxies written, nested in their element
    thread 'proxies_have_revits_ports_nested' panicked at tests/proxy_ports.rs:171:5:
    RE1-Electrical.rvt: 30 of Revit's 30 ports on family instances rvt-rs writes as proxies are not written nested in their element; first: [(428352, 1), (476276, 1), (476469, 1), (476602, 1), (477108, 1), (477740, 1), (477846, 1), (477893, 1)]
    RE1-Mechanical.rvt: 6 of Revit's 6 ports on family instances rvt-rs writes as proxies are not written nested in their element; first: [(427568, 6), (427568, 7), (427568, 8), (427568, 9), (427568, 10), (427568, 11)]
    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.49s
… in it (B83)

Revit's export of RE1 Electrical writes 30 of its 53 ports on elements both
it and rvt-rs write as proxies (panels, receptacles, switches, junction
boxes, sensors). rvt-rs gave ports to distribution elements only, as it ties
each with an IfcRelConnectsPortToElement, which IFC4 restricts to
distribution elements. Revit's own IFC4 export (revit-ifc ConnectorExporter)
nests every port in its element with an IfcRelNests named NestedPorts.

- attach_family_instance_ports gives a proxy a port per symbol connector,
  as it does a distribution element (RE-169).
- The writer nests a proxy's ports in it, one IfcRelNests per proxy
  ('NestedPorts', 'Flow'); every other port keeps its
  IfcRelConnectsPortToElement.
- tools/re/ports_vs_ifc.py reads nested ports as tied to their element.
This was referenced Oct 5, 2026
@DrunkOnJava
DrunkOnJava merged commit 4f0f6cc into main Oct 5, 2026
24 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/b83-nested-proxy-ports branch October 5, 2026 11:22
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