2021-01-03 19:09:01 +11:00
|
|
|
from blenderbim.bim.ifc import IfcStore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Data:
|
|
|
|
|
products = {}
|
2021-01-06 10:28:22 +11:00
|
|
|
representations = {}
|
2021-01-03 19:09:01 +11:00
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def load(cls, product_id):
|
|
|
|
|
file = IfcStore.get_file()
|
|
|
|
|
if not file:
|
|
|
|
|
return
|
2021-01-06 10:28:22 +11:00
|
|
|
cls.products[product_id] = []
|
2021-01-03 19:09:01 +11:00
|
|
|
product = file.by_id(product_id)
|
2021-01-06 15:19:55 +11:00
|
|
|
if not hasattr(product, "Representation") or not product.Representation:
|
2021-01-03 19:09:01 +11:00
|
|
|
return
|
|
|
|
|
for representation in product.Representation.Representations:
|
|
|
|
|
c = representation.ContextOfItems
|
2021-01-06 10:28:22 +11:00
|
|
|
rep_id = int(representation.id())
|
|
|
|
|
cls.representations[rep_id] = {
|
2021-01-03 19:09:01 +11:00
|
|
|
"RepresentationIdentifier": representation.RepresentationIdentifier,
|
|
|
|
|
"RepresentationType": representation.RepresentationType,
|
|
|
|
|
"ContextOfItems": {
|
|
|
|
|
"ContextType": c.ContextType,
|
|
|
|
|
"ContextIdentifier": c.ContextIdentifier,
|
|
|
|
|
"TargetView": c.TargetView if c.is_a("IfcGeometricRepresentationSubContext") else "",
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-06 10:28:22 +11:00
|
|
|
cls.products[product_id].append(rep_id)
|