mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user