mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Column profiles now auto update when you change the material profile
This commit is contained in:
@@ -62,14 +62,15 @@ def get_type(element):
|
||||
return relationship.RelatingType
|
||||
|
||||
|
||||
def get_material(element):
|
||||
def get_material(element, should_skip_usage=False):
|
||||
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
|
||||
if should_skip_usage:
|
||||
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:
|
||||
|
||||
@@ -221,7 +221,7 @@ class Selector:
|
||||
key = ".".join(key.split(".")[1:])
|
||||
elif "." in key and key.split(".")[0] == "material":
|
||||
try:
|
||||
element = ifcopenshell.util.element.get_material(element)
|
||||
element = ifcopenshell.util.element.get_material(element, should_skip_usage=True)
|
||||
if not element:
|
||||
return None
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user