Skip to main content

create_control

Function create_control 

Source
pub fn create_control(
    tx: &mut Transaction,
    schema: &Schema,
    kind: ControlKind,
    global_id: &str,
    predefined_type: Option<&str>,
    draft: ControlDraft<'_>,
) -> ControlResult<EntityId>
Expand description

Stage one control record, laid out by attribute name in schema.

OwnerHistory is left unset, which IFC4 and IFC4X3 allow. IFC2X3 requires it, so an IFC2X3 schema is refused with ControlError::AuthoringRequired instead of written as $; use create_control_with_owner_history there. Before #198 an IFC2X3 IfcPermit, IfcActionRequest or IfcPerformanceHistory panicked here, indexing past their six declared attributes.

§Errors

Refuses a malformed GlobalId; a blank name; a token outside the entity’s own enum; USERDEFINED without object_type; a life_cycle_phase on an entity that does not declare it and a missing one on IfcPerformanceHistory; status or long_description on IfcPerformanceHistory; and an entity the schema does not declare. Against the release’s own table: a value the entity does not declare there (AuthoringNotInSchema, such as an IFC2X3 PredefinedType on a permit), one it cannot hold (AuthoringValueType), and a required one left unset (AuthoringRequired, such as the IFC2X3 OwnerHistory or PermitID). Nothing is staged on an error.