Skip to content

IFC4 writer omits the trailing PredefinedType attribute on building elements #214

Closed

Description

@DrunkOnJava

Pre-existing, found while validating #204's output with IfcOpenShell 0.8.5. Not introduced by that PR — IFCSLAB and IFCSPACE on main have the same shape.

src/ifc/step_writer.rs emits building elements with eight attributes:

#338=IFCCOLUMN('0rvtrs000000000000005I',#5,'Column-20375',$,$,#330,#337,'20375');
#201=IFCSLAB('0rvtrs0000000000000039',#5,'Floor-unnamed',$,$,#200,$,$);
#165=IFCSPACE('0rvtrs000000000000002b',#5,'Room-unnamed',$,$,#164,$,$);

IFC4 IfcColumn, IfcSlab, IfcSpace, IfcWall, IfcDoor, IfcWindow and friends all declare a ninth attribute (PredefinedType; IfcSpace also has ElevationWithFlooring as a tenth). Optional attributes still occupy their slot as $ — omitting them entirely makes the instance non-conformant, even though most readers tolerate it.

Symptom:

>>> c.PredefinedType
RuntimeError: Index 8 is out of range for variant of size 8

IfcOpenShell parses the file and finds every entity, so this has not tripped the ifcopenshell-validate CI job — it only surfaces when a consumer reads the attribute. src/ifc/category_map.rs already carries the right values (Mapping::predefined_type: COLUMN for Column / StructuralColumn, FLOOR for Floor, STANDARD for Wall, …); they are simply never written.

Fix: emit the full attribute list per entity type, writing $ where no predefined type is known and the mapped value where one is. Add a schema-conformance assertion to the IfcOpenShell gate so this cannot regress silently — reading PredefinedType on one entity of each emitted type would have caught it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions