Repository navigation
red: B86 MEP joins test - #707
Closed
DrunkOnJava wants to merge 6 commits into
Closed
DrunkOnJava wants to merge 6 commits into
DrunkOnJava wants to merge 6 commits into
Conversation
…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.
Owner
Author
|
Red recorded (Corpus health run 37302264599). The implementation reads joins from the family instances' native connectors (RE-171) and is in the B86 pull request. |
DrunkOnJava
added a commit
that referenced
this pull request
Oct 5, 2026
…native connectors (B86, RE-171) (#716) B86, the rest of B54 (#528): the 13 joins of Revit's RE1 export that rvt-rs did not read. **Red.** `tests/mep_connections.rs` requires every join Revit's export writes between two elements rvt-rs writes with ports, and no join rvt-rs writes between two elements Revit holds that is not Revit's. On draft #707 (Corpus health run 37302264599) it failed with Plumbing 6 of 126 not written and Mechanical 7 of 73. That red result was in hand before the native implementation below was written. The proxy-filter commit was written while that run was still going. **What reads the joins.** A `FamilyInstance` record holds a `Connector` object per connector. Each one gives its index (`m_nIndex`) and lists, in `m_arrRefs`, the elements joined to it with their connector indices and a connection type. RE-171's probe (run 37303312731) scored the type-1 references against Revit's exports: | model | Revit's joins | native type-1 references | not Revit's | |---|---:|---:|---:| | RE1 Mechanical | 73 | 73 | 0 | | RE1 Plumbing | 126 | 126 | 2 (both on tank 442378, which Revit's export leaves out, RE-169) | `native_connectors::family_instance_joins` reads them from the MEP categories' family instances, selected by id. The export uses them wherever the native record path reads the file (Revit 2023 to 2027). The byte-form lists (RE-138, RE-141) remain the fallback on 2025, the one release they are measured on. Joins whose other end is a proxy are now written, because proxies carry ports since B83. **Why not widen the byte form.** A side agent pointed out that the alternative, accepting lists with any terminal or equipment first, found anywhere, with indices up to 31, would be matched on bytes alone, and only RE1 could catch a false match. On Autodesk's 2025 MEP samples that version added 252 and 249 joins. The native connectors there hold 2,609 and 2,652. The byte form disagrees with them in two ways (runs 37303169279, 37306537328): - **Duct ends.** 207 of main's 265 joins that native lacks are the same two elements joined at the other end of the duct. That is the earlier-copy inversion rule, measured on RE1 only, misreading the samples. - **Impossible joins.** Main joins 11 and 12 duct or pipe ends twice, which cannot happen. Native joins none twice, on every file. **Measure** (run 37306537328, head 55a6830 against `main` plus the join-list probe): - **RE1.** Mechanical 73 of 73 and Plumbing 126 of 126 joins written. The only two not in Revit's export are the tank's. No port is untied, and there are no schema findings. - **Samples.** The 2024, 2025 and 2026 MEP samples each write 2,609 (`rme_advanced`) and 2,652 (`rme_basic`) joins, the same project in three releases. 2024 and 2026 wrote none before. - **Unchanged.** Every other model's and sample's output is identical. - **Timing (one runner).** Core Interior, Einhoven, the architecture samples and 2027 read 0.93 to 1.03. The MEP samples read 1.06 to 1.16, because they now decode their MEP instances' records and write about 2,600 more joins each. The probes `examples/probe_re171_connector_refs.rs` and `examples/probe_re170_join_list.rs`, and the RE-170 and RE-171 report, follow in their own research pull request. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes how MEP joins are discovered and which IFC port connections are emitted, with broad impact on MEP exports but a version fallback and new regression test against Revit reference exports. > > **Overview** > MEP connector joins are now taken primarily from **native `FamilyInstance` connector references** (type-1 `m_arrRefs` entries) via `native_connectors::family_instance_joins`, scoped to 18 MEP equipment/terminal classes so full-model furniture decode is avoided. When native records are unavailable, the existing **byte-form** `partition_connector_pairs` scans remain the fallback on supported Revit versions. > > Decoded join fields are attached to **any element** that has pairs, not only ducts, pipes, and fittings—so terminals, equipment, and similar instances participate in export. > > IFC **`IfcRelConnectsPorts`** emission treats **`IfcBuildingElementProxy`** as port-bearing alongside distribution elements, so joins involving proxies (e.g. mechanical AHU to ducts) are written when both ends export with ports. > > A new **`mep_connections`** corpus test compares port-to-port joins in rvt-rs STEP output against Revit’s reference IFC for RE1 Electrical, Plumbing, and Mechanical; CI includes this target. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit dc2771c. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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.
Red check for B86's test, on top of B83 (#705). Closed once the failing output is recorded.
Note
Medium Risk
Changes IFC export topology for MEP ports on building element proxies; behavior is constrained by new corpus parity tests but affects interoperability with tools that consume port relationships.
Overview
IFC4 proxy MEP ports now follow Revit’s export: family instances emitted as
IfcBuildingElementProxyget connector ports from the same native path as distribution elements, and the STEP writer nests those ports under the proxy withIfcRelNestsinstead ofIfcRelConnectsPortToElement(IFC4 only ties ports to distribution elements).Port-to-port joins (
IfcRelConnectsPorts) are unchanged; only how a proxy’s ports attach to their host element differs. Distribution elements still useIfcRelConnectsPortToElement.Regression coverage adds corpus tests (
proxy_ports,proxy_connections) against Revit’sRE1-*.ifcwhenRVT_PROJECT_CORPUS_DIRis set, plus CI targets and an update toports_vs_ifc.pyso scoring treats nested proxy ports like Revit’s IFC4 export.Reviewed by Cursor Bugbot for commit f4e9d4c. Configure here.