IFClite TypeScript API
    Preparing search index...

    Function extractLengthUnitScale

    • Extract length unit scale factor from IFC file

      Follows the chain: IFCPROJECT → IFCUNITASSIGNMENT → IFCSIUNIT/IFCCONVERSIONBASEDUNIT Returns the multiplier to convert coordinates to meters.

      Every 1.0 this function returns for a path OTHER than "IFCSIUNIT length unit with no prefix" is an unconfirmed default, not a confirmed metre declaration — those paths call warnUnknownUnit exactly once per entityIndex so the ambiguity is visible instead of silent (#2104). The no-prefix IFCSIUNIT case is a genuine, confirmed "this file declares meters" and intentionally does not warn.

      Parameters

      • source: Uint8Array<ArrayBufferLike> | IfcSourceBytes

        The IFC file bytes, either raw or behind IfcSourceBytes

      • entityIndex: {
            byId: { get(expressId: number): EntityRef | undefined };
            byType: Map<string, number[]>;
        }

        Entity index with byId and byType maps

      • OptionalprojectId: number

        Optional express id of the specific IFCPROJECT to read units from. Most files declare exactly one, so the default (the file's first IFCPROJECT) is correct for the overwhelmingly common case; pass this explicitly when resolving units for an entity that may belong to a later IFCPROJECT in a multi-project (federated-merge, see #1332) file — see resolveOwningIfcProjectId.

      Returns number

      Scale factor to apply to length values (e.g., 0.001 for millimeters)