mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
WIP refactor representation editing into geometry module. See #1222. Some new functionality as a result:
- Representations can now be added to any context, even invalid ones, non-subcontext, or missing target views - Switching representations now change all linked data objects
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
|
||||
class Data:
|
||||
products = {}
|
||||
|
||||
@classmethod
|
||||
def load(cls, product_id):
|
||||
file = IfcStore.get_file()
|
||||
if not file:
|
||||
return
|
||||
cls.products[product_id] = {"Representations": {}}
|
||||
product = file.by_id(product_id)
|
||||
if not product.Representation:
|
||||
return
|
||||
for representation in product.Representation.Representations:
|
||||
c = representation.ContextOfItems
|
||||
cls.products[product_id]["Representations"][int(representation.id())] = {
|
||||
"RepresentationIdentifier": representation.RepresentationIdentifier,
|
||||
"RepresentationType": representation.RepresentationType,
|
||||
"ContextOfItems": {
|
||||
"ContextType": c.ContextType,
|
||||
"ContextIdentifier": c.ContextIdentifier,
|
||||
"TargetView": c.TargetView if c.is_a("IfcGeometricRepresentationSubContext") else "",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user