Skip to content

feat(ifc): a family instance has a port for each of its symbol's connectors, joined or not (B54) - #680

Merged
DrunkOnJava merged 4 commits into
mainfrom
feat/b54-family-ports
Oct 4, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
feat/b54-family-ports

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

#528. A FamilySymbol's native record lists its connectors (m_arrConnectorData, each an m_index); its Family holds a ConnectorDataCell per connector with its domain. On RE1 Electrical, Plumbing and Mechanical every family instance Revit writes ports for has exactly its symbol's connector indices, the cable tray and conduit ones aside (Measure run 37230166352). rvt-rs wrote ports only for the joins it read.

native_connectors::symbol_port_indices reads them through the native record path (2023 to 2027), and the export gives each family instance written as a distribution element a port per connector; the writer skips one a join already gave.

Red on draft #678 (run 37230564190): Electrical 0 of 23, Plumbing 128 of 136, Mechanical 78 of 82; the output is in the test commit. Electrical's 30 proxies keep no ports: IFC4 lets a port be tied only to a distribution element.


Note

Medium Risk
Adds a native-record dependency on the IFC export path and expands port emission for MEP family instances; failures are mostly silent (no ports) but wrong connector filtering could mismatch Revit’s IFC.

Overview
B54 (#528) extends IFC export so family instances written as distribution elements get an IfcDistributionPort for each symbol connector Revit would export—not only connectors that appear in join records (ducts/pipes already got ports 0 and 1).

A new native_connectors module reads FamilySymbol / Family native records via native_document::extract, maps connector indices to domains, and keeps HVAC, electrical, and piping connectors (excludes cable tray and conduit). attach_family_instance_ports runs late in the export pipeline, looks up each distribution building element’s type symbol, and pushes IfcEntity::Port rows; the STEP writer still skips ports a PortConnection already created. If native records cannot be read for the file release, behavior falls back to join-only ports.

Docs on IfcEntity::Port and is_distribution_element (now pub(crate)) are updated. A corpus integration test family_instance_ports compares exported ports to Revit’s RE1 Electrical/Plumbing/Mechanical IFC references for distribution-entity family instances.

Reviewed by Cursor Bugbot for commit 59ebdf3. Configure here.

…s Revit's export writes them (B54)

Revit's export of the RE1 MEP models writes a port for every connector of a
family instance, joined or not. tests/family_instance_ports.rs requires
rvt-rs to write each such port on an element it writes as a distribution
element, Port_<ElementId>_<index>, tied to the element with that Tag.

Red on main (draft #678, run 37230564190, "Corpus health (tier 2)"):

  RE1-Electrical.rvt: 0 of Revit's 23 family-instance ports written
  RE1-Plumbing.rvt: 128 of Revit's 136 family-instance ports written
  RE1-Mechanical.rvt: 78 of Revit's 82 family-instance ports written
  panicked at tests/family_instance_ports.rs:173:5:
  RE1-Electrical.rvt: 23 of Revit's 23 ports on family instances rvt-rs writes as distribution elements are not written, tied to their element; first: [(441149, 1), (441150, 1), (441151, 1), (441152, 1), (441153, 1), (441154, 1), (441155, 1), (441156, 1)]
  RE1-Plumbing.rvt: 8 of Revit's 136 ports on family instances rvt-rs writes as distribution elements are not written, tied to their element; first: [(442581, 1), (442625, 1), (443223, 1), (443279, 1), (443513, 1), (446093, 2), (446093, 4), (447727, 1)]
  RE1-Mechanical.rvt: 4 of Revit's 82 ports on family instances rvt-rs writes as distribution elements are not written, tied to their element; first: [(433643, 1), (433747, 1), (490317, 1), (491631, 1)]
…ectors, joined or not (B54)

A FamilySymbol's native record lists its connectors in m_arrConnectorData
(each an m_index), and its Family holds a ConnectorDataCell per connector
with its domain. On RE1 Electrical, Plumbing and Mechanical every family
instance Revit writes ports for has exactly its symbol's connector indices,
the cable tray and conduit ones (domain 4) aside (Measure run 37230166352:
one panel's five conduit connectors get no port). rvt-rs wrote ports only
for joins it read.

native_connectors::symbol_port_indices reads the indices through the native
record path (2023 to 2027) and the export gives each family instance it
writes as a distribution element a port for each; the writer skips a port a
join has already given. A release the native path does not read keeps its
join ports.
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 4, 2026 20:20
@DrunkOnJava
DrunkOnJava merged commit 8e63803 into main Oct 4, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/b54-family-ports branch October 4, 2026 20:24
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
…ectors (B54, B38) (#681)

The research behind #680, with its probes.

- A FamilySymbol's native record lists its connectors
(m_arrConnectorData, m_index); its Family has a ConnectorDataCell per
index with the domain. On RE1 Electrical, Plumbing and Mechanical, every
family instance's ports in Revit's export are its symbol's connector
indices. The cable tray and conduit domain is the exception: one panel's
five conduit connectors get no port (run 37230166352).
- B38: RE1 Plumbing's tank 442378, which Revit's export leaves out, was
created in New Construction, is demolished in no phase, is in the main
model and is visible. No record in the file holds DontExport,
IfcExportAs or IFCExport. It differs from the exported fixtures only in
being unhosted and level-based. Why Revit leaves it out stays open (runs
37229407104, 37229769241).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Additive research examples and documentation only; no library or
export behavior changes in this diff.
> 
> **Overview**
> Adds **RE-169 research artifacts** (backlog B54/B38, issues #528/#328)
documenting how Revit IFC ports map to family-symbol connectors and why
one plumbing tank is missing from Revit's export.
> 
> Three new **`examples/` probes** drive measure workflows:
`probe_re169_symbol_connectors` compares Revit `IFCDISTRIBUTIONPORT`
indices to native `FamilySymbol`/`Family` connector data on RE1 MEP
models; `probe_re169_tank_fields` dumps native fields for tank 442378 vs
an exported fixture; `probe_re169_export_flag` scans the model for
`DontExport` / `IfcExportAs` / `IFCExport` and related family
references.
> 
> The report **`reports/element-framing/RE-169-symbol-connectors.md`**
records findings: exported ports match symbol connector indices (except
cable-tray/conduit domain on one panel), ties the conclusion to **#680**
(`native_connectors::symbol_port_indices`), and notes tank 442378 is
visible/unflagged but unhosted—export omission remains unexplained.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4c7cd61. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
Measure appends `milliseconds <n>` to each model's and sample's
rvt-ifc.log, so a slower export shows up in the base/head comparison
like any other output change. Run 37237567160 used it to time main
against 8cdfba1, the commit before #680: the native passes added by #680
and #684 cost about 1 to 4 s per MEP export and nothing on 2016 to 2022.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> CI-only timing instrumentation in the measure script; no runtime or
export behavior changes.
> 
> **Overview**
> The Measure CI script now records **wall-clock time** for each
`rvt-ifc` export on reference models and Autodesk sample projects.
> 
> Before each export it captures a nanosecond timestamp; after the run
it appends `milliseconds <n>` to that model's `rvt-ifc.log` (alongside
the existing exit status). Base/head artifact diffs can then surface
export slowdowns the same way as other log changes.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c951e05. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
…rameter-definition pass (B80) (#690)

native_document::extract first decodes every parameter-definition owner
in the file (for saved parameter values), then makes its selected pass.
The export's two native consumers, family-instance ports (#680) and duct
shapes (#684), read objects' fields only. They now call the new
extract_graphs, which makes the selected pass alone.

Measure run 37241187730 (samples, against main) shows the IFC
byte-identical on all six models and 36 samples. Wall time across them
falls from 288.8 s to 226.8 s:

| file | main | this PR |
|---|---:|---:|
| 2025 rme_advanced | 44.9 s | 32.3 s |
| 2025 rme_basic | 39.5 s | 28.7 s |
| 2024 rme_advanced | 32.9 s | 23.8 s |
| 2026 rme_advanced | 30.7 s | 22.6 s |
| 2025 rac_advanced | 5.8 s | 4.5 s |

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Targeted performance path change with measured IFC parity; only
affects native readers that do not rely on resolved parameter
definitions.
> 
> **Overview**
> Adds **`native_document::extract_graphs`**, which runs the
selected-record object-graph pass only—skipping **`extract`**'s upfront
scan of every parameter-definition owner in the file. Callers that read
native object fields (not saved parameter values) no longer pay that
definition-ingest cost.
> 
> **Family-instance port indices** (`symbol_port_indices`) and **duct
type shapes** (`duct_type_shapes`) now use `extract_graphs` instead of
`extract` for their FamilySymbol/Family and `AbsDuctType` passes. Saved
metadata on those records is projected with an empty definition
registry, which matches graph-only field reads.
> 
> Export output stays byte-identical on measured models; wall time drops
materially because the definition pass is avoided on these hot paths
(B80).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4684b53. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
DrunkOnJava added a commit that referenced this pull request Oct 5, 2026
#680 to #728 (#729)

BACKLOG.md and CHANGELOG.md for this stretch of session 3: B74 and B79
to B87, the CI audit's items C1 to C10 with their pull requests and
evidence, Corpus health's failure rate without the red drafts, zizmor's
first findings, the writer-path coverage, and the CHANGELOG entries for
the user-visible changes (MEP export speed, ports and joins, the
rvt-wasm crate). It merges last, after the pull requests it describes.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only changes to backlog and release notes; no runtime,
export, or CI behavior is modified in this PR.
> 
> **Overview**
> Updates **maintainer docs only** (`BACKLOG.md`, `CHANGELOG.md`) to
reflect session 3 work through early October 2025—no application or CI
workflow code in this diff.
> 
> **`CHANGELOG.md` [Unreleased]** gains user-facing notes for merged
work: MEP ports/joins/nesting (B54, B83–B86, B84), duct naming and
`Shape` (B59, B43), space types (B78), `--saved-meshes` on 2025/2026
(B77), `typed-no-geometry` typing fix (B74), the **`rvt-wasm`** split
(C6), and the **B80** perf stack (native graph reuse, partition scans,
SIMD Adler-32, shared extractions, room-outline pass, curve scan
bounds). Measure timing/`ifc_flags` (B81) and research notes (e.g.
RE-169) are added; the interim B77 restriction on `--saved-meshes` is
removed in favor of the measured enablement.
> 
> **`BACKLOG.md`** re-ranks and closes many items (B43, B59, B74,
B76–B83, B85, B87, etc.), marks B54/B80/B84/B86 and CI items **C4–C10**
as in progress, and adds **B78–B87**. A new **CI audit (2026-10-05)**
section documents C1–C10 (required `CI passed`, cache keys,
CodeQL/deploy/crates.io, fuzz, runners, speed, release/nightly, corpus
pins, stale checks, Dependabot/zizmor) with run IDs and maintainer
decisions. The **progress log** expands with session 3 evening entries
(red/green runs, Measure evidence, rule slips).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1eadb18. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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