Skip to content

feat(ifc-geometry)!: refuse models without a declared length unit - #586

Merged
GeneralPawz merged 13 commits into
mainfrom
fix/585-units
Oct 28, 2026
Merged

GeneralPawz merged 13 commits into
mainfrom
fix/585-units

Conversation

@GeneralPawz

Copy link
Copy Markdown
Contributor

units::resolve now returns GeometryResult and refuses instead of assuming metres:

  • no IfcProject / UnitsInContext / LENGTHUNIT -> LengthUnitUndeclared
  • unreadable length or angle unit -> UnitUnreadable (unknown prefix, SI unit not METRE/RADIAN, context-dependent or offset unit, non-numeric factor)
  • two projects or two units of one kind -> UnitsAmbiguous
  • a missing PLANEANGLEUNIT refuses only where an angle is read (AngleUnitUndeclared); angle_to_radians is Option
  • UnitScale::Default removed; UnitScale::SI is explicit
  • conversion-based units now apply their UnitComponent (inch as 25.4 MILLI METRE was read as 25.4 m)

Facade: a model whose units do not resolve refuses every product with that error; bindings map it to invalid-model.

Breaking: ifc-geometry 0.32.0, openbim-ifc 0.39.0 at release.

Closes #585

Four typed refusals for a model whose units have no usable scale (#585).
IFC defines no default length or plane angle unit and UnitsInContext is
optional on IfcContext in IFC4, so resolve assumed a scale the file never
stated. resolve now returns a typed refusal; a missing angle unit is
refused only where an angle is read. IfcMeasureWithUnit values are read in
their UnitComponent; unknown SI prefixes and misnamed SI units are refused.
UnitScale::default is replaced by UnitScale::SI. Refs #585.
…units

Product geometry entry points carry the unit refusal on every requested
product instead of placing the model in metres. Refs #585.
Models and fixtures that declare no units read in UnitScale::SI or through
tests/support/assume_units.rs; the committed fixtures are unchanged. Adds the
#585 repro and reworks units_on_fixtures to count resolved and refused
fixtures.
error.rs crossed the 800-line limit with the unit refusals.
Inline models state a metre and a radian; a model without a length unit
refuses each product's placement with invalid-model. Refs #585.
AlignmentUnits::angle_to_radians is optional. A StartDirection without a
plane-angle unit refuses with AngleUnitUndeclared; length-only bridges
(linear placements, seam tolerance) no longer need one. ifc-geometry maps
the refusal back to GeometryError::AngleUnitUndeclared.
…eferred

A Cartesian-preferred conic trim with a point needs no plane-angle unit.
…ansform

world_transform resolves the project units first so a model without units
reports LengthUnitUndeclared. The fixture corpus test asserts lower bounds.
@GeneralPawz
GeneralPawz merged commit caa2350 into main Oct 28, 2026
22 checks passed
@GeneralPawz
GeneralPawz deleted the fix/585-units branch October 28, 2026 19:49
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.

ifc-geometry: units::resolve silently assumes metres when no length unit is declared

1 participant