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_unitconverts a value between two named units;IfcModel::convert_unit_valuebetween two unit entities of the model (anIfcSIUnit,IfcConversionBasedUnitorIfcDerivedUnit).format_lengthwrites a length as decimal text in a unit, or as feet and inches with fractions.IfcModel::convert_length_unitrescales every length-dimensioned value of the model to a new project length unit as one checked transaction (the facade’sconvert_length_unit), or withdry_runonly reports. ItsLengthUnitReportlists 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§
- Converted
Values - Values of one attribute of one entity type that were rescaled.
- Kept
Values - Length-like values of one attribute left as they are.
- Length
Unit Options - What
IfcModel::convert_length_unitdoes beyond the length unit. - Length
Unit Report - What a length-unit conversion did, or, for a dry run, would do.
Functions§
- convert_
unit - Convert
valuefrom the unit namedfromto the unit namedto. - format_
length - Write
value, a length in the unit namedunit, as text.styleisdecimal(indisplay_unit, defaultunit, withplacesdigits after the point),feet-inches(rounded to1/placesof an inch,5' - 6 1/2"; withsuppress_zero_inches, a whole foot is5') orinches(66 1/2").