Skip to main content

create_planar_extent

Function create_planar_extent 

Source
pub fn create_planar_extent(
    tx: &mut Transaction,
    model: &Model,
    schema: &Schema,
    size_in_x: f64,
    size_in_y: f64,
    placement: Option<EntityId>,
) -> StyleResult<EntityId>
Expand description

Pick whichever spelling of an attribute the target schema declares.

A handful of attributes were renamed between IFC4 and IFC4X3 without moving slot or changing type: IfcFillAreaStyle.ModelorDraughting became ModelOrDraughting, and IfcCurveStyleFontAndScaling.CurveFont became CurveStyleFont. Writing a hardcoded spelling makes the writer refuse its own output under the other schema, so the candidates are resolved against the schema in use. Falls back to the first candidate so an unknown entity still produces the usual build_named error rather than a silent miss. Stage an IfcPlanarExtent, or its IfcPlanarBox subtype.

The extent is a rectangular presentation area: two sizes and, for the box form, the placement that positions it. Sizes are IfcLengthMeasure, which admits negatives in the type system; a negative or non-finite extent describes no area, so it is refused here rather than written for a reader to puzzle over.

Passing a placement selects IfcPlanarBox; omitting it stages the plain extent. The two share slots 0 and 1, so the subtype only ever adds.

ยงErrors

Refuses a non-finite or non-positive SizeInX/SizeInY, and a placement that is not an IfcAxis2Placement2D/3D.