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

30 lines
1.1 KiB
Python

from blenderbim.bim.ifc import IfcStore
class Data:
products = {}
representations = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
if not file:
return
cls.products[product_id] = []
product = file.by_id(product_id)
if not hasattr(product, "Representation") or not product.Representation:
return
for representation in product.Representation.Representations:
c = representation.ContextOfItems
rep_id = int(representation.id())
cls.representations[rep_id] = {
"RepresentationIdentifier": representation.RepresentationIdentifier,
"RepresentationType": representation.RepresentationType,
"ContextOfItems": {
"ContextType": c.ContextType,
"ContextIdentifier": c.ContextIdentifier,
"TargetView": c.TargetView if c.is_a("IfcGeometricRepresentationSubContext") else "",
}
}
cls.products[product_id].append(rep_id)