Skip to main content

body_description

Function body_description 

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

Describe the Body representation of product.

Returns Ok(None) when the product has no body representation (only an Axis or FootPrint, or none at all): that is an answer, not a failure. A body whose representation lists no items yields an empty items. Equivalent to body_description_for with RepresentationPurpose::Body.

Every item is described or the call fails; see the module docs. A Body tessellated item is now read for its bounds, so a malformed face set or a TIN with void or hole flags fails the whole description. Kernel-free: available with --no-default-features.

let scale = units::resolve(model)?;
let body = body_description(model, &scale, beam).unwrap().expect("a body");
let item = body.sole_item().expect("one item");
if item.kind == BodyKind::Extrusion {
    let swept = item.swept.as_ref().unwrap();
    if let SweepPath::Extrusion { direction_world, depth, .. } = swept.path {
        let _ = (swept.profile.type_name.as_str(), direction_world, depth);
    }
}