2021-01-04 15:57:12 +11:00
|
|
|
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)
|
2021-01-05 13:16:31 +11:00
|
|
|
if not hasattr(product, "ContainedInStructure"):
|
|
|
|
|
cls.products[product_id] = None
|
|
|
|
|
elif product.ContainedInStructure:
|
2021-01-04 16:23:36 +11:00
|
|
|
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}
|