@@ -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