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 schema pairs with kind; see OccurrenceError::WrongTypeClass.

Refuses a malformed global_id, a predefined_type outside the class enum, USERDEFINED without draft.object_type, and a typed_by of the wrong class or one that does not resolve.

§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 cannot carry (IFC2X3 IfcStair.ShapeType, for one) is refused the same way. The type pairing is the IFC4X3 CorrectTypeAssigned class of the catalogue row in every release.

§Errors

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