Module unit_labels

Module unit_labels 

Source
Expand description

Unit labels and the scales they resolve to.

Two readers need the same answer to “what does this unit label mean in metres”: crate::units, reading an IfcSIUnit/IfcConversionBasedUnit declaration, and crate::georef, reading the free-text ePSet_ProjectedCRS.MapUnit of the IFC2x3 georeferencing convention. Both tables and the MapUnit label rules live here so the two cannot drift; the units:: paths are preserved as re-exports.

Structs§

SiPrefix
One member of the IfcSIPrefix EXPRESS enumeration.

Constants§

SI_PREFIXES
The one IfcSIPrefix table (CORE-26, XCUT-6): the multiplier readers (try_si_prefix_multiplier), the display symbols (crate::project_units::symbols::si_prefix_symbol) and the exporters’ prefix-name checks all derive from these sixteen rows.
US_SURVEY_FOOT_M
1200/3937 m, exactly: the US survey foot, distinct from the international 0.3048. The one definition (CORE-26, EXPORT-STEP-20): the former core copy was truncated to 0.3048006096 (4e-12 relative).

Functions§

get_conversion_based_unit_factor
Known conversion factors for imperial/conversion-based units to meters These are the standard conversions defined in IFC specification
get_si_prefix_multiplier
SI Prefix multipliers as defined in IFC specification. Maps IfcSIPrefix enum values to their numeric multipliers; an absent or unrecognised prefix means the base unit (metres), i.e. 1.0. Callers that must distinguish those two cases want try_si_prefix_multiplier.
is_us_survey_foot_key
Is key — an already-folded (alphanumeric, upper-cased) label — one of the glued US-survey-foot spellings? Shared with the exporters’ map-unit normaliser so the spelling list has one home.
is_us_survey_foot_tokens
Order-insensitive recogniser for the separated US-survey foot spellings — foot (US survey), SURVEY FEET (US), US survey foot. The glued spellings (USSURVEYFOOT, FTUS, …) are matched exactly in [resolve_exact_unit_label]; once an exporter puts separators in, the word order varies and gluing alone cannot see it.
si_prefix
The SI_PREFIXES row for a member of the IfcSIPrefix EXPRESS enumeration (exact token, no dots), or None.
try_si_prefix_multiplier
SI Prefix multiplier for a member of the IfcSIPrefix EXPRESS enumeration, or None when the string is not one of its sixteen members.