mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +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
|
obj = context.active_object
|
||||||
element = tool.Ifc.get_entity(obj)
|
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")
|
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.y = data["y"]
|
||||||
props.z = data["z"]
|
props.z = data["z"]
|
||||||
props.use_local_space = data.get("use_local_space", False)
|
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.dimension_input_type = data.get("dimension_input_type", "Increment")
|
||||||
props.is_editing = self.item
|
props.is_editing = self.item
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -106,6 +116,7 @@ class EditArray(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
"y": props.y,
|
"y": props.y,
|
||||||
"z": props.z,
|
"z": props.z,
|
||||||
"use_local_space": props.use_local_space,
|
"use_local_space": props.use_local_space,
|
||||||
|
"sync_children": props.sync_children,
|
||||||
"dimension_input_type": props.dimension_input_type,
|
"dimension_input_type": props.dimension_input_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -269,6 +269,11 @@ class BIMArrayProperties(PropertyGroup):
|
|||||||
name="Type of input dimension",
|
name="Type of input dimension",
|
||||||
default="Increment",
|
default="Increment",
|
||||||
)
|
)
|
||||||
|
sync_children: bpy.props.BoolProperty(
|
||||||
|
name="Sync Children",
|
||||||
|
description="Keep children objects in sync with parent object",
|
||||||
|
default = False,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BIMStairProperties(PropertyGroup):
|
class BIMStairProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ class BIM_PT_array(bpy.types.Panel):
|
|||||||
row.prop(props, "dimension_input_type")
|
row.prop(props, "dimension_input_type")
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
row.prop(props, "use_local_space")
|
row.prop(props, "use_local_space")
|
||||||
#row = box.row(align=True)
|
row.prop(props, "sync_children")
|
||||||
col = box.column()
|
col = box.column()
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
row.prop(props, "x")
|
row.prop(props, "x")
|
||||||
|
|||||||
@@ -414,6 +414,14 @@ class Model(blenderbim.core.tool.Model):
|
|||||||
obj_stack = [parent]
|
obj_stack = [parent]
|
||||||
|
|
||||||
for array in data:
|
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
|
child_i = 0
|
||||||
existing_children = set(array["children"])
|
existing_children = set(array["children"])
|
||||||
total_existing_children = len(array["children"])
|
total_existing_children = len(array["children"])
|
||||||
|
|||||||
Reference in New Issue
Block a user