BimCT SDK / WebGL2 Viewer
    Preparing search index...

    Function formatToSystemMeasurementUnit

    • Converts a value and its unit to the specified measurement system (Imperial or Metric).

      Parameters

      • ms: MEASUREMENT_SYSTEM

        The target measurement system. Possible values:

        • MEASUREMENT_SYSTEM.IMPERIAL (converts to Imperial units).
        • MEASUREMENT_SYSTEM.METRIC (converts to Metric units).
      • unit: string

        The original unit of the value. Supported units include:

        • Metric: 'MM', 'M2', 'M3', 'KG'.
      • value: number

        The value associated with the given unit to be converted.

      Returns { unit: string; value: number }

      • An object containing:
        • unit: The converted unit in the target measurement system.
        • value: The converted value in the target measurement system.
      • formatToSystemMeasurementUnit(MEASUREMENT_SYSTEM.IMPERIAL, 'MM', 1000) returns { unit: 'in', value: 39.3701 } (1000 mm to inches).
      • formatToSystemMeasurementUnit(MEASUREMENT_SYSTEM.IMPERIAL, 'M2', 50) returns { unit: 'ft', value: 538.196 } (50 square meters to square feet).
      • formatToSystemMeasurementUnit(MEASUREMENT_SYSTEM.METRIC, 'MM', 12000) returns { unit: 'm', value: 12 } (12,000 mm to meters).
      • The function takes into account the current i18next locale for unit translations.
      • The function ensures logical unit conversion based on magnitude (e.g., mm to m for large lengths, mm to in/ft for Imperial).
      • For Imperial conversions, area and volume are expressed with superscript Unicode symbols (² and ³).
      • For unsupported units, the input remains unchanged.