Layer set usages now inherit layer sets from the type. Walls now support material layer set usages. Also minor fixes, thanks s-leger!

This commit is contained in:
Dion Moult
2021-05-25 13:10:26 +10:00
parent 32fb359ee2
commit a13b71abf0
5 changed files with 36 additions and 17 deletions
@@ -1,4 +1,5 @@
import ifcopenshell
import ifcopenshell.util.element
class Usecase:
@@ -18,7 +19,15 @@ class Usecase:
material_set = self.file.create_entity(self.settings["type"])
self.create_material_association(material_set)
elif self.settings["type"] == "IfcMaterialLayerSetUsage":
material_set = self.file.create_entity("IfcMaterialLayerSet")
element_type = ifcopenshell.util.element.get_type(self.settings["product"])
if element_type:
element_type_material = ifcopenshell.util.element.get_material(element_type)
if element_type_material and element_type_material.is_a("IfcMaterialLayerSet"):
material_set = element_type_material
else:
material_set = self.file.create_entity("IfcMaterialLayerSet")
else:
material_set = self.file.create_entity("IfcMaterialLayerSet")
material_set_usage = self.create_layer_set_usage(material_set)
self.create_material_association(material_set_usage)
elif self.settings["type"] == "IfcMaterialProfileSet":
@@ -79,10 +79,6 @@ def get_material(element):
if hasattr(relating_type, "HasAssociations") and relating_type.HasAssociations:
for relationship in relating_type.HasAssociations:
if relationship.is_a("IfcRelAssociatesMaterial"):
if relationship.RelatingMaterial.is_a("IfcMaterialLayerSetUsage"):
return relationship.RelatingMaterial.ForLayerSet
elif relationship.RelatingMaterial.is_a("IfcMaterialProfileSetUsage"):
return relationship.RelatingMaterial.ForProfileSet
return relationship.RelatingMaterial