mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Fix #2937. IFC Array now have the option to sync children
This commit is contained in:
@@ -34,7 +34,16 @@ class AddArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
obj = context.active_object
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
|
||||
array = {"children": [], "count": 1, "x": 0.0, "y": 0.0, "z": 0.0, "use_local_space": True, "dimension_input_type": "Increment"}
|
||||
array = {
|
||||
"children": [],
|
||||
"count": 1,
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"use_local_space": True,
|
||||
"sync_children": False,
|
||||
"dimension_input_type": "Increment",
|
||||
}
|
||||
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||
|
||||
@@ -81,6 +90,7 @@ class EnableEditingArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
props.y = data["y"]
|
||||
props.z = data["z"]
|
||||
props.use_local_space = data.get("use_local_space", False)
|
||||
props.sync_children = data.get("sync_children", False)
|
||||
props.dimension_input_type = data.get("dimension_input_type", "Increment")
|
||||
props.is_editing = self.item
|
||||
return {"FINISHED"}
|
||||
@@ -106,6 +116,7 @@ class EditArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
"y": props.y,
|
||||
"z": props.z,
|
||||
"use_local_space": props.use_local_space,
|
||||
"sync_children": props.sync_children,
|
||||
"dimension_input_type": props.dimension_input_type,
|
||||
}
|
||||
|
||||
|
||||
@@ -269,6 +269,11 @@ class BIMArrayProperties(PropertyGroup):
|
||||
name="Type of input dimension",
|
||||
default="Increment",
|
||||
)
|
||||
sync_children: bpy.props.BoolProperty(
|
||||
name="Sync Children",
|
||||
description="Keep children objects in sync with parent object",
|
||||
default = False,
|
||||
)
|
||||
|
||||
|
||||
class BIMStairProperties(PropertyGroup):
|
||||
|
||||
@@ -227,7 +227,7 @@ class BIM_PT_array(bpy.types.Panel):
|
||||
row.prop(props, "dimension_input_type")
|
||||
row = box.row(align=True)
|
||||
row.prop(props, "use_local_space")
|
||||
#row = box.row(align=True)
|
||||
row.prop(props, "sync_children")
|
||||
col = box.column()
|
||||
row = col.row(align=True)
|
||||
row.prop(props, "x")
|
||||
|
||||
@@ -414,6 +414,14 @@ class Model(blenderbim.core.tool.Model):
|
||||
obj_stack = [parent]
|
||||
|
||||
for array in data:
|
||||
if array["sync_children"]:
|
||||
removed_children = set(array["children"])
|
||||
for removed_child in removed_children:
|
||||
element = tool.Ifc.get().by_guid(removed_child)
|
||||
obj = tool.Ifc.get_object(element)
|
||||
if obj:
|
||||
bpy.data.objects.remove(obj)
|
||||
|
||||
child_i = 0
|
||||
existing_children = set(array["children"])
|
||||
total_existing_children = len(array["children"])
|
||||
|
||||
Reference in New Issue
Block a user