mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
You can now export container data from IFCCSV
This commit is contained in:
@@ -83,6 +83,11 @@ def get_material(element):
|
||||
return relationship.RelatingMaterial
|
||||
|
||||
|
||||
def get_container(element):
|
||||
if hasattr(element, "ContainedInStructure") and element.ContainedInStructure:
|
||||
return element.ContainedInStructure[0].RelatingStructure
|
||||
|
||||
|
||||
def replace_attribute(element, old, new):
|
||||
for i, attribute in enumerate(element):
|
||||
if attribute == old:
|
||||
|
||||
@@ -227,6 +227,14 @@ class Selector:
|
||||
except:
|
||||
return
|
||||
key = ".".join(key.split(".")[1:])
|
||||
elif "." in key and key.split(".")[0] == "container":
|
||||
try:
|
||||
element = ifcopenshell.util.element.get_container(element)
|
||||
if not element:
|
||||
return None
|
||||
except:
|
||||
return
|
||||
key = ".".join(key.split(".")[1:])
|
||||
info = element.get_info()
|
||||
if key in info:
|
||||
return info[key]
|
||||
|
||||
Reference in New Issue
Block a user