Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit 54b4cef

Browse files
committed
fix errors appending related materials in ifc2x3
it wasn't processing materials properties correctly because it was expecting material to have class IfcMaterialDefinition
1 parent c6106e6 commit 54b4cef

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def execute(self):
129129
self.added_elements: dict[int, ifcopenshell.entity_instance] = {}
130130
self.reuse_identities: dict[int, ifcopenshell.entity_instance] = self.settings["reuse_identities"]
131131
self.whitelisted_inverse_attributes = {}
132+
self.base_material_class = "IfcMaterial" if self.file.schema == "IFC2X3" else "IfcMaterialDefinition"
133+
132134
if self.settings["element"].is_a("IfcTypeProduct"):
133135
self.target_class = "IfcTypeProduct"
134136
return self.append_type_product()
@@ -179,7 +181,7 @@ def append_profile_def(self):
179181
def append_type_product(self):
180182
self.whitelisted_inverse_attributes = {
181183
"IfcObjectDefinition": ["HasAssociations"],
182-
"IfcMaterialDefinition": ["HasExternalReferences", "HasProperties", "HasRepresentation"],
184+
self.base_material_class: ["HasExternalReferences", "HasProperties", "HasRepresentation"],
183185
"IfcRepresentationItem": ["StyledByItem"],
184186
}
185187
self.existing_contexts = self.file.by_type("IfcGeometricRepresentationContext")
@@ -192,7 +194,7 @@ def append_product(self):
192194
"IfcObjectDefinition": ["HasAssociations"],
193195
"IfcObject": ["IsDefinedBy.IfcRelDefinesByProperties"],
194196
"IfcElement": ["HasOpenings"],
195-
"IfcMaterialDefinition": ["HasExternalReferences", "HasProperties", "HasRepresentation"],
197+
self.base_material_class: ["HasExternalReferences", "HasProperties", "HasRepresentation"],
196198
"IfcRepresentationItem": ["StyledByItem"],
197199
}
198200
self.existing_contexts = self.file.by_type("IfcGeometricRepresentationContext")

0 commit comments

Comments
 (0)