IFClite TypeScript API
    Preparing search index...

    Function resolveOwningIfcProjectId

    • Resolve the express id of the IFCPROJECT that owns expressId, for files that legitimately contain more than one IFCPROJECT — the shape MergedExporter's documented auto unit-reconciliation mode produces for a federated merge of differently-unit'd models (see issue #1332). An ordinary IFC file has exactly one IFCPROJECT by EXPRESS invariant, so this is a no-op fast path there.

      extractLengthUnitScale/extractProjectUnits resolve the file's FIRST IFCPROJECT only unless given an explicit projectId; every entity belonging to a LATER project in a multi-project file was silently read against the first project's units. Callers needing per-entity correctness (both resolveEntityLengthUnitScale in unit-extractor.ts and @ifc-lite/ids's area/volume resolution, which needs the project id itself rather than just a length scale) resolve this id first and pass it on to extractLengthUnitScale/extractProjectUnits's projectId parameter.

      Walks the entity's real spatial containment up to its own project: IfcRelContainedInSpatialStructure (element → structure), then IfcRelAggregates (child → parent, repeated to the project), with an IfcRelDefinesByType (type → one of the objects it defines) hop for a type entity that has no containment of its own. Containment is tried first since it's the one-hop case for the common "element straight into its storey" shape.

      Parameters

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

      Returns number | undefined

      The owning project's express id, or undefined when the file has zero or one IFCPROJECT (nothing to resolve) or the walk can't reach one (e.g. a resource-level entity with no containment, a cyclic/malformed graph). Callers should fall back to the file's default project on undefined, matching prior single-project behaviour.