File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
ifcblenderexport/blenderbim/bim
ifcopenshell-python/ifcopenshell/util Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -771,13 +771,13 @@ def get_ifc_element(self, global_id):
771771
772772 def get_classes (self , element , position ):
773773 classes = [position , element .is_a ()]
774- for association in element .HasAssociations :
775- if association .is_a ("IfcRelAssociatesMaterial" ):
776- classes .append (
777- "material-{}" .format (
778- re .sub ("[^0-9a-zA-Z]+" , "" , self .get_material_name (association .RelatingMaterial ))
779- )
774+ material = ifcopenshell .util .element .get_material (element )
775+ if material :
776+ classes .append (
777+ "material-{}" .format (
778+ re .sub ("[^0-9a-zA-Z]+" , "" , self .get_material_name (material ))
780779 )
780+ )
781781 classes .append ("globalid-{}" .format (element .GlobalId ))
782782 for attribute in self .attributes :
783783 result = self .selector .get_element_value (element , attribute )
Original file line number Diff line number Diff line change @@ -67,11 +67,19 @@ def get_material(element):
6767 if hasattr (element , "HasAssociations" ) and element .HasAssociations :
6868 for relationship in element .HasAssociations :
6969 if relationship .is_a ("IfcRelAssociatesMaterial" ):
70+ if relationship .RelatingMaterial .is_a ("IfcMaterialLayerSetUsage" ):
71+ return relationship .RelatingMaterial .ForLayerSet
72+ elif relationship .RelatingMaterial .is_a ("IfcMaterialProfileSetUsage" ):
73+ return relationship .RelatingMaterial .ForProfileSet
7074 return relationship .RelatingMaterial
7175 relating_type = get_type (element )
7276 if hasattr (relating_type , "HasAssociations" ) and relating_type .HasAssociations :
7377 for relationship in relating_type .HasAssociations :
7478 if relationship .is_a ("IfcRelAssociatesMaterial" ):
79+ if relationship .RelatingMaterial .is_a ("IfcMaterialLayerSetUsage" ):
80+ return relationship .RelatingMaterial .ForLayerSet
81+ elif relationship .RelatingMaterial .is_a ("IfcMaterialProfileSetUsage" ):
82+ return relationship .RelatingMaterial .ForProfileSet
7583 return relationship .RelatingMaterial
7684
7785
You can’t perform that action at this time.
0 commit comments