Skip to main content

product_world_transform

Function product_world_transform 

Source
pub fn product_world_transform(
    model: &Model,
    units: &UnitScale,
    product: EntityId,
) -> GeometryResult<Transform>
Expand description

The world transform for one product, in metres.

Resolves the placement chain – IfcLocalPlacement, IfcGridPlacement and IfcLinearPlacement links alike (#357, #362, #363) – and converts the composed result once. A linear placement reads its cached CartesianPosition, and curved grid axes are refused by name: both need a curve evaluator, which product_world_transform_with_evaluator (feature compile) takes. A product with no ObjectPlacement is model-space, which the schema allows, so it yields the identity rather than an error.

Cyclic and over-deep chains are reported as errors rather than hanging or overflowing the stack, so a malformed file cannot lock up a viewer.

let world = product_world_transform(model, units, wall).unwrap();
let [x, y, z] = world.origin;

Resolving many products reuses ancestor transforms through PlacementResolver; see products_world_transforms for the batch form, which is what a whole-model walk should use.