Material profile set usages are now supported. Hooray! Thanks Jesusbill!

This commit is contained in:
Dion Moult
2021-04-15 18:38:28 +10:00
parent 776c68e2b0
commit 65d0abd072
5 changed files with 39 additions and 10 deletions
@@ -318,6 +318,10 @@ class EnableEditingAssignedMaterial(bpy.types.Operator):
material_set_class = "IfcMaterialLayerSet"
elif product_data["type"] == "IfcMaterialProfileSet":
material_set_data = Data.profile_sets[product_data["id"]]
elif product_data["type"] == "IfcMaterialProfileSetUsage":
profile_set_usage = Data.profile_set_usages[product_data["id"]]
material_set_data = Data.profile_sets[profile_set_usage["ForProfileSet"]]
material_set_class = "IfcMaterialProfileSet"
elif product_data["type"] == "IfcMaterialList":
material_set_data = Data.lists[product_data["id"]]
else:
@@ -409,7 +413,7 @@ class EnableEditingMaterialSetItem(bpy.types.Operator):
material_set_item_data = Data.constituents[self.material_set_item]
elif product_data["type"] == "IfcMaterialLayerSet" or product_data["type"] == "IfcMaterialLayerSetUsage":
material_set_item_data = Data.layers[self.material_set_item]
elif product_data["type"] == "IfcMaterialProfileSet":
elif product_data["type"] == "IfcMaterialProfileSet" or product_data["type"] == "IfcMaterialProfileSetUsage":
material_set_item_data = Data.profiles[self.material_set_item]
else:
material_set_item_data = {}
@@ -542,7 +546,7 @@ class EditMaterialSetItem(bpy.types.Operator):
},
)
Data.load_layers()
elif product_data["type"] == "IfcMaterialProfileSet":
elif product_data["type"] == "IfcMaterialProfileSet" or product_data["type"] == "IfcMaterialProfileSetUsage":
profile_attributes = {}
for attribute in props.material_set_item_profile_attributes:
if attribute.data_type == "string":
@@ -70,6 +70,7 @@ def getMaterialTypes(self, context):
"IfcMaterialLayerSet",
"IfcMaterialLayerSetUsage",
"IfcMaterialProfileSet",
"IfcMaterialProfileSetUsage",
"IfcMaterialList",
]
if IfcStore.get_file().schema == "IFC2X3":
@@ -82,6 +82,13 @@ class BIM_PT_object_material(Panel):
self.set_items = self.material_set_data["MaterialProfiles"] or []
self.set_data = Data.profiles
self.set_item_name = "profile"
elif self.product_data["type"] == "IfcMaterialProfileSetUsage":
self.material_set_usage = Data.profile_set_usages[self.product_data["id"]]
self.material_set_id = self.material_set_usage["ForProfileSet"]
self.material_set_data = Data.profile_sets[self.material_set_id]
self.set_items = self.material_set_data["MaterialProfiles"] or []
self.set_data = Data.profiles
self.set_item_name = "profile"
elif self.product_data["type"] == "IfcMaterialList":
self.material_set_id = self.product_data["id"]
self.material_set_data = Data.lists[self.material_set_id]