Setup array constraints for annotations that use paramatric arrays

Previously you was able to add parametric array to annotations but constraint would be missing on file reload.
This commit is contained in:
Andrej730
2025-04-29 17:26:08 +05:00
parent b8ee1d4d8d
commit dc46afc227
2 changed files with 9 additions and 3 deletions
+8 -3
View File
@@ -1136,7 +1136,7 @@ class IfcImporter:
bpy.ops.view3d.view_selected()
bpy.ops.object.select_all(action="DESELECT")
def setup_arrays(self, elements: Optional[set[ifcopenshell.entity_instance]] = None):
def setup_arrays(self, annotations_to_import: Optional[set[ifcopenshell.entity_instance]] = None) -> None:
for pset in self.file.by_type("IfcPropertySet"):
if pset.Name != "BBIM_Array":
continue
@@ -1144,10 +1144,15 @@ class IfcImporter:
continue
data = json.loads(data)
for rel in pset.DefinesOccurrence:
element: ifcopenshell.entity_instance
for element in rel.RelatedObjects:
if element.is_a("IfcAnnotation"):
if annotations_to_import is None:
# IfcAnnotations are not loaded during base import.
continue
if element.is_a("IfcAnnotation"):
continue
else:
if element not in annotations_to_import:
continue
for i in range(len(data)):
tool.Blender.Modifier.Array.set_children_lock_state(element, i, True)
tool.Blender.Modifier.Array.constrain_children_to_parent(element)
+1
View File
@@ -742,6 +742,7 @@ class Drawing(bonsai.core.tool.Drawing):
ifc_importer.load_existing_meshes()
ifc_importer.material_creator.load_existing_materials()
ifc_importer.create_generic_elements(elements)
ifc_importer.setup_arrays(elements)
for obj in ifc_importer.added_data.values():
tool.Collector.assign(obj)