Skip to main content

Module units

Module units 

Source
Expand description

Unit conversion and a model’s length unit (feature properties, #469).

A unit is named as text, as ifc::properties::ConversionUnit::parse reads it: an SI unit with its prefix written before it (METRE, MILLIMETRE, MILLI METRE, SQUARE_MILLIMETRE, KILOGRAM; METER spellings accepted), or a named conversion-based unit of IFC4 Table 673 with exact factors (inch, foot, yard, mile, square foot, gallon US, pound, degree …) or US survey foot.

  • convert_unit converts a value between two named units; IfcModel::convert_unit_value between two unit entities of the model (an IfcSIUnit, IfcConversionBasedUnit or IfcDerivedUnit).
  • format_length writes a length as decimal text in a unit, or as feet and inches with fractions.
  • IfcModel::convert_length_unit rescales every length-dimensioned value of the model to a new project length unit as one checked transaction (the facade’s convert_length_unit), or with dry_run only reports. Its LengthUnitReport lists the rescaled attributes, the values kept with the reason, and the units written and removed.

Refusals: invalid-value for text that names no unit, an unknown prefix, a target that is not a length unit, or a bad format; type-mismatch for units of different dimensions; unsupported for a monetary or context-dependent unit, a unit with an offset (degree Fahrenheit, IfcConversionBasedUnitWithOffset: not applied until #110 is settled), and values the conversion cannot carry (each named in the detail); invalid-model when the project length unit cannot be resolved; unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3; missing-entity for a unit id the model lacks; feature-disabled without properties.

Structs§

ConvertedValues
Values of one attribute of one entity type that were rescaled.
KeptValues
Length-like values of one attribute left as they are.
LengthUnitOptions
What IfcModel::convert_length_unit does beyond the length unit.
LengthUnitReport
What a length-unit conversion did, or, for a dry run, would do.

Functions§

convert_unit
Convert value from the unit named from to the unit named to.
format_length
Write value, a length in the unit named unit, as text. style is decimal (in display_unit, default unit, with places digits after the point), feet-inches (rounded to 1/places of an inch, 5' - 6 1/2"; with suppress_zero_inches, a whole foot is 5') or inches (66 1/2").