Assigning a representation to a product type now syncs mapped representations of all of its typed products.

This commit is contained in:
Dion Moult
2021-05-18 16:41:30 +10:00
parent 0822d1d377
commit cbce3cbec0
2 changed files with 97 additions and 72 deletions
@@ -35,4 +35,18 @@ class Usecase:
)
)
self.settings["product"].RepresentationMaps = maps
if self.file.schema == "IFC2X3":
types = self.settings["product"].ObjectTypeOf
else:
types = self.settings["product"].Types
if types:
for element in types[0].RelatedObjects:
mapped_representation = ifcopenshell.api.run(
"geometry.map_representation", self.file, **{"representation": self.settings["representation"]}
)
ifcopenshell.api.run(
"geometry.assign_representation",
self.file,
**{"product": element, "representation": mapped_representation}
)
ifcopenshell.api.run("owner.update_owner_history", self.file, **{"element": self.settings["product"]})