Skip to main content

create

Function create 

Source
pub fn create(
    tx: &mut Transaction,
    model: &Model,
    kind: Occurrence,
    global_id: &str,
    predefined_type: Option<&str>,
    typed_by: Option<EntityId>,
    draft: OccurrenceDraft<'_>,
) -> OccurrenceResult<EntityId>
Expand description

Stage one occurrence.

typed_by is the IfcTypeObject this occurrence takes its shared definition from, if any. It is checked against the one class the declared release pairs with kind; see OccurrenceError::WrongTypeClass and OccurrenceError::TypeClassNotInSchema.

Refuses a malformed global_id, a predefined_type outside the class enum, USERDEFINED without draft.object_type, a typed_by of the wrong class or one that does not resolve, a shape_type or bar_role outside its enumeration (OccurrenceError::UnknownToken), and a measure the attribute does not admit (OccurrenceError::InvalidMeasure).

§Release

Written in the model’s declared release (#202), laid out by attribute name from its table; a header without FILE_SCHEMA binds IFC4. predefined_type is checked against that release’s enumeration, and a class the release does not declare is refused with OccurrenceError::EntityNotInSchema. OwnerHistory is left $, which IFC4 and IFC4X3 allow and IFC2X3 does not, so an IFC2X3 model is refused with OccurrenceError::AuthoringRequired; use create_with_owner_history there. Any other attribute the release requires and the draft leaves unset (IFC2X3 IfcStair.ShapeType, for one) is refused the same way, and a draft value for an attribute the release does not declare on the class with OccurrenceError::AuthoringNotInSchema. The type pairing is the bound release’s own.

§Errors

The refusals above; OccurrenceError::MultipleSchemas or OccurrenceError::UnsupportedSchema for a model that binds no single known release. Nothing is staged on an error.