Files
IfcOpenShell/src/ifcblenderexport/blenderbim/bim/module/spatial/data.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
666 B
Python
Raw Normal View History

from blenderbim.bim.ifc import IfcStore
class Data:
products = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
if not file:
return
product = file.by_id(product_id)
if not hasattr(product, "ContainedInStructure"):
cls.products[product_id] = None
elif product.ContainedInStructure:
structure = product.ContainedInStructure[0].RelatingStructure
cls.products[product_id] = {"type": structure.is_a(), "Name": structure.Name, "id": int(structure.id())}
else:
cls.products[product_id] = {"type": None, "Name": None, "id": None}