Skip to content

feat(create): LandXML station equations as IfcReferent; profiles read through them (mapping v1.3) (#5634) - #5932

Merged
louistrue merged 1 commit into
mainfrom
feat/5634-landxml-referents
Sep 25, 2026
Merged

louistrue merged 1 commit into
mainfrom
feat/5634-landxml-referents

Conversation

@louistrue

@louistrue louistrue commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #5634 (LandXML → IFC follow-ups): station equations, profiles on alignments that have station equations, and the CgPoint → IfcReferent question from §9.3. Rebased onto #5930 (vertical profiles, main 96b04045f).

What changed

Spec first. Mapping document and LANDXML_IFC_MAPPING_VERSION go to 1.3. There is a new §14, and §11.5, §12.2, §12.4 and §12.6 are updated so they no longer say station equations or profiles on such alignments are refused. §13 is left free for cant.

Station equations → IfcReferent / .STATION. (§14.1–14.2).

  • For every written alignment, each StaEquation becomes an IfcReferent with Pset_Stationing:

    • Station = staAhead
    • IncomingStation = staBack. If staBack is absent, it is derived from the running stationing using the same rule as rust/landxml's station_mapping, including a decreasing run.
    • HasIncreasingStation = staIncrement, written only when authored.

    The property definitions come from the IFC 4.3 template IfcOpenShell 0.8.5 bundles (the buildingSMART docs site returned 403).

  • Placement. IfcLinearPlacement whose IfcPointByDistanceExpression measures staInternal − staStart on the alignment's IfcCompositeCurve, with the evaluated point and tangent as CartesianPosition. This is the same structure as the start referent and IfcOpenShell's add_stationing_referent. With a vertical layout, the composite curve is the FootPrint curve, which is also what IfcOpenShell's get_basis_curve returns.

  • Nesting. Start referent first, then equations in order along the alignment. IfcOpenShell's helper sorts by Station, which gives a different order after a backward jump; HasIncreasingStation is defined over the order along the alignment.

  • Refusal is all or none per alignment. If any equation is malformed, at or before the start, past the end, or out of order (Rust's LXMLA207), all of that alignment's equations are refused by name. The alignment itself is still written.

Profiles through station equations (§14.5, lifts #5930's refusal).

  • PVI stations are read as displayed stations and placed where the written stationing shows them (distancesForStation, a port of rust/landxml's distances_for_station).
  • Only genuinely ambiguous cases are refused, each naming the PVI:
    • a station that falls in a forward jump's gap;
    • a station displayed at more than one place, listing every distance;
    • a profile on an alignment whose equations were themselves refused.
  • A vertical curve's lengths are horizontal lengths, so a curve that contains an equation is not ambiguous.
  • This depends on a premise. LandXML does not say explicitly whether PVI stations are internal or displayed. §14.5 states the choice and why: displayed is what a designer reads off the stationed alignment, and it is what the viewer's station probe resolves.

CgPoint (§14.3): re-argued, still IfcAnnotation / .SURVEY., output unchanged.

  • A CgPoint carries no alignment and no station.
  • The points an alignment references are construction points.
  • Writing both an annotation and a referent would double every survey point.

Code. New files: landxml/station-equations.ts (mapping and distancesForStation) and ifc-creator-alignment-referents.ts (emitter; the start referent moved here with unchanged output). profile-mapping.ts gains an optional stationing parameter. Edits to shared files are additive:

Fixture and evidence

Fixture (make_alignment_fixture.py / alignment_fixture.json):

  • A-Left carries one forward jump (internal 1200 → displayed 1250) under its profile. P-Left is designed in internal stations as before, then authored in displayed stations. The IFC must therefore carry the same geometry as without the jump, and only a correct station-to-distance mapping produces that.
  • A-Compound, which has no profile, carries:
    • a backward jump below the start station;
    • a decreasing run starting in the finite-start clothoid;
    • a derived IncomingStation.
  • The IFC contains 7 referents in total.

IfcOpenShell checks:

  • check_vertical.py (feat(create): map LandXML vertical profiles to IfcAlignmentVertical (#5634) #5930's): 2 vertical layouts checked, 0 problems. IfcOpenShell evaluates P-Left, read through the equation, to the generator's heights.
  • check_referents.py (new): 7 referents checked, 0 problems. It uses IfcOpenShell's API to check nest order, Pset_Stationing values, DistanceAlong on the basis curve, and the kernel-evaluated point against the generator's own integration, plus CartesianPosition and tangent. Fault injection (shifting each equation 1 km) fails it with named problems.
  • check_alignment.py: 3 alignments checked, 0 problems.
  • ifcopenshell.validate(express_rules=True): 0 issues.

Tests:

  • landxml-to-ifc.station-equations.test.ts: values, order, derived back station, GlobalIds, units, one test per §14.2 refusal reason, and the creator-level guard.
  • landxml-to-ifc-vertical-stationing.test.ts: the fixture profile is placed at 300 m, not 350 m; a forward-jump placement; gap and double-display refusals.
  • feat(create): map LandXML vertical profiles to IfcAlignmentVertical (#5634) #5930's refusal case now asserts the "equations not written" refusal.

Results (at 1ea5c085b, on main 96b04045f)

  • packages/create vitest with IFCOPENSHELL_PYTHON set: 53 files, 848 tests passed, none skipped.

  • Viewer LandXML export tests (ExportDialog.landxml, landXmlIfcPlan, landXmlIfcDownload): 38 passed, 0 failed.

  • Revert oracle (--base HEAD~1, over the three touched test files): OBSERVED. The baseline passes 25 of 25. With production reverted, every file fails by assertion:

    • conformance: 2 of 10 fail
    • vertical-stationing: 4 of 4 fail
    • station-equations: 11 of 11 fail

    The oracle restored the tree cleanly.

  • Gates:

    • pnpm lint: 0 errors
    • check-module-size: OK
    • check-unused-locals: no new unused locals
    • api-surface:update: adds only StationEquationParams
    • check-changeset-bump: OK
    • check-changesets: OK
    • check-mkdocs-nav: OK
    • docs:check-samples: 1 failure, from main and not this branch. docs/guide/bcf.md:235 imports BCFOverlayRenderer, which @ifc-lite/bcf no longer exports.

Deliberately left out

  • IfcReferent for CgPoint (§14.3).
  • No IfcRelPositions for equation referents, since they position no product.
  • If profile stations turn out to be internal stations for some producer, §14.5 is the one place to change. The test that asserts the mapped 300 m distance would flag the difference.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 21 billable files and costs up to $5.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 50 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: LTplus-AG/ifc-lite/.coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: bc78fce2-c565-4d8e-8832-4e8da7c7a90d

📥 Commits

Reviewing files that changed from the base of the PR and between 678bfa2 and b6cefe7.

📒 Files selected for processing (21)
  • .changeset/landxml-station-equation-referents.md
  • .github/workflows/export-schema-conformance.yml
  • docs/architecture/landxml-to-ifc-mapping.md
  • packages/create/src/ifc-creator-alignment-referents.ts
  • packages/create/src/ifc-creator-alignment.ts
  • packages/create/src/index.ts
  • packages/create/src/landxml/ifcopenshell-conformance.test.ts
  • packages/create/src/landxml/landxml-to-ifc-roundtrip.test.ts
  • packages/create/src/landxml/landxml-to-ifc-vertical-stationing.test.ts
  • packages/create/src/landxml/landxml-to-ifc-vertical.test.ts
  • packages/create/src/landxml/landxml-to-ifc.station-equations.test.ts
  • packages/create/src/landxml/landxml-to-ifc.ts
  • packages/create/src/landxml/profile-mapping.ts
  • packages/create/src/landxml/refusals.ts
  • packages/create/src/landxml/station-equations.ts
  • packages/create/src/landxml/writers.ts
  • scripts/api-surface.json
  • tools/ifcopenshell_reference/alignment_fixture.json
  • tools/ifcopenshell_reference/check_referents.py
  • tools/ifcopenshell_reference/check_vertical.py
  • tools/ifcopenshell_reference/make_alignment_fixture.py

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Sep 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_021b1e85-860c-4d19-9e87-e7b156f9cae8)

@github-actions

Copy link
Copy Markdown
Contributor

Claude review - no findings for 6364d361c

Reviewed this diff and found nothing to flag.

@github-actions github-actions Bot added the llm-reviewed A review was verified as posted for this PR's head. label Sep 25, 2026
…ofiles through them (#5634)

Mapping v1.3 (spec section 14). Each StaEquation on a written alignment
becomes an IfcReferent/.STATION. carrying Pset_Stationing (Station,
IncomingStation, HasIncreasingStation), linearly placed at its distance
along the alignment's composite curve and nested with the start referent in
order along the alignment. An alignment's equations are refused all or
none, by name, when one cannot be placed.

A vertical profile on an alignment with station equations is no longer
refused: its PVI stations are read as displayed stations and placed through
the written stationing (rust/landxml's distances_for_station); only a
station in an equation gap or displayed at more than one place is refused.

Section 14.3 re-argues 9.3: CgPoints stay IfcAnnotation/.SURVEY.

IfcOpenShell reads the referents back (check_referents.py), and
check_vertical.py grades the profile authored in displayed stations on the
fixture's station-equation alignment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@louistrue
louistrue force-pushed the feat/5634-landxml-referents branch from 6364d36 to b6cefe7 Compare September 25, 2026 11:21
@louistrue louistrue changed the title feat(create): write LandXML station equations as IfcReferent with Pset_Stationing (#5634) feat(create): LandXML station equations as IfcReferent; profiles read through them (mapping v1.3) (#5634) Sep 25, 2026
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated
ifc-lite-dev Ignored Ignored Sep 25, 2026 11:21am UTC
ifc-lite-viewer-embed Ignored Ignored Sep 25, 2026 11:21am UTC

@cursor

cursor Bot commented Sep 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7e16da93-4415-44d2-8ef0-503665ee100b)

@github-actions github-actions Bot removed the llm-reviewed A review was verified as posted for this PR's head. label Sep 25, 2026
@louistrue
louistrue merged commit f34299c into main Sep 25, 2026
70 of 79 checks passed
@louistrue
louistrue deleted the feat/5634-landxml-referents branch September 28, 2026 10:29
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