From 3477d3f1a255d1b75a0ffb79e30bb2c8b2cb13e4 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 9 Nov 2020 21:03:21 +1100 Subject: [PATCH] Implement import support for material profile sets --- .../blenderbim/bim/import_ifc.py | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index 6c24b0eea9..89f2024b91 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -162,7 +162,7 @@ class MaterialCreator: elif material.is_a("IfcMaterialLayerSet"): self.create_layer_set(material) elif material.is_a("IfcMaterialProfileSet"): - pass # TODO + self.create_profile_set(material) def create_usage_definition(self, material): if material.is_a("IfcMaterialLayerSetUsage"): @@ -217,6 +217,28 @@ class MaterialCreator: new.fraction = constituent.Fraction or 0.0 new.category = constituent.Category or "" + def create_profile_set(self, profile_set): + props = self.obj.BIMObjectProperties + props.material_type = "IfcMaterialProfileSet" + props.material_set.name = profile_set.Name or "" + props.material_set.description = profile_set.Description or "" + for profile in profile_set.MaterialProfiles: + new = props.material_set.material_profiles.add() + new.name = profile.Name or "" + new.description = profile.Description or "" + if profile.Material.Name not in self.materials: + # TODO import rest of the layer set data + self.create_new_single(profile.Material) + self.assign_material_to_mesh(self.materials[profile.Material.Name]) + new.material = self.materials[profile.Material.Name] + new.profile = profile.Profile.is_a() + for i, attribute in enumerate(profile.Profile): + newa = new.profile_attributes.add() + newa.name = profile.Profile.attribute_name(i) + newa.string_value = str(attribute) + new.priority = profile.Priority or 0 + new.category = profile.Category or "" + def create_material_list(self, material_list): for material in material_list.Materials: if material.Material: