mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
You can now apply drawing styles to elements with material set usages
This commit is contained in:
@@ -771,13 +771,13 @@ class IfcCutter:
|
||||
|
||||
def get_classes(self, element, position):
|
||||
classes = [position, element.is_a()]
|
||||
for association in element.HasAssociations:
|
||||
if association.is_a("IfcRelAssociatesMaterial"):
|
||||
classes.append(
|
||||
"material-{}".format(
|
||||
re.sub("[^0-9a-zA-Z]+", "", self.get_material_name(association.RelatingMaterial))
|
||||
)
|
||||
material = ifcopenshell.util.element.get_material(element)
|
||||
if material:
|
||||
classes.append(
|
||||
"material-{}".format(
|
||||
re.sub("[^0-9a-zA-Z]+", "", self.get_material_name(material))
|
||||
)
|
||||
)
|
||||
classes.append("globalid-{}".format(element.GlobalId))
|
||||
for attribute in self.attributes:
|
||||
result = self.selector.get_element_value(element, attribute)
|
||||
|
||||
@@ -67,11 +67,19 @@ def get_material(element):
|
||||
if hasattr(element, "HasAssociations") and element.HasAssociations:
|
||||
for relationship in element.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
|
||||
relating_type = get_type(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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user