Fix #6873. Bug where geometry created through sync_references didn't have item editing metadata.

This commit is contained in:
Dion Moult
2025-10-06 17:23:23 +11:00
parent 839c5ad932
commit 99fa77edee
2 changed files with 12 additions and 4 deletions
+4
View File
@@ -72,6 +72,10 @@ def assign_class(
"""
Args:
context: is not optional if `should_add_representation` is True
TODO: Do NOT use should_add_representation. Because it internally calls
geometry.add_representation which is 1,000 lines of Blender -> IFC magic.
Instead, explicitly create a representation using tool.Geometry.
"""
if ifc.get_entity(obj):
return
+8 -4
View File
@@ -1552,12 +1552,10 @@ class Drawing(bonsai.core.tool.Drawing):
context=context,
ifc_representation_class=None,
)
if representation := ifcopenshell.util.representation.get_representation(element, context):
cls.reload_representation(obj=obj, representation=representation)
bpy.data.curves.remove(data)
assert element
representation = ifcopenshell.util.representation.get_representation(element, context)
assert representation
obj.data["ios_edges_item_ids"] = (representation.Items[0].id(),)
return element
@classmethod
@@ -1645,6 +1643,8 @@ class Drawing(bonsai.core.tool.Drawing):
context=context,
ifc_representation_class=None,
)
if representation := ifcopenshell.util.representation.get_representation(element, context):
cls.reload_representation(obj=obj, representation=representation)
return element
@classmethod
@@ -1682,6 +1682,8 @@ class Drawing(bonsai.core.tool.Drawing):
context=context,
ifc_representation_class=None,
)
if representation := ifcopenshell.util.representation.get_representation(element, context):
cls.reload_representation(obj=obj, representation=representation)
return element
@classmethod
@@ -1782,6 +1784,8 @@ class Drawing(bonsai.core.tool.Drawing):
context=context,
ifc_representation_class=None,
)
if representation := ifcopenshell.util.representation.get_representation(element, context):
cls.reload_representation(obj=obj, representation=representation)
return element
@classmethod