mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +00:00
ifc array modifier: adds the option to choose between "total" and "increment" as dimension input
This commit is contained in:
committed by
Dion Moult
parent
a1adbe2b34
commit
2cd7e737cd
@@ -34,7 +34,7 @@ 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}
|
array = {"children": [], "count": 1, "x": 0.0, "y": 0.0, "z": 0.0, "use_local_space": True, "dimension_input_type": "Increment"}
|
||||||
|
|
||||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||||
|
|
||||||
@@ -81,6 +81,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.dimension_input_type = data.get("dimension_input_type", "Increment")
|
||||||
props.is_editing = self.item
|
props.is_editing = self.item
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -105,6 +106,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,
|
||||||
|
"dimension_input_type": props.dimension_input_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
props.is_editing = -1
|
props.is_editing = -1
|
||||||
|
|||||||
@@ -261,6 +261,14 @@ class BIMArrayProperties(PropertyGroup):
|
|||||||
description="Use local space for array items offset instead of world space",
|
description="Use local space for array items offset instead of world space",
|
||||||
default=True,
|
default=True,
|
||||||
)
|
)
|
||||||
|
dimension_input_type: bpy.props.EnumProperty(
|
||||||
|
items=(
|
||||||
|
("Increment", "Increment", ""),
|
||||||
|
("Total", "Total", ""),
|
||||||
|
),
|
||||||
|
name="Type of input dimension",
|
||||||
|
default="Increment",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BIMStairProperties(PropertyGroup):
|
class BIMStairProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -224,6 +224,8 @@ class BIM_PT_array(bpy.types.Panel):
|
|||||||
row.operator("bim.edit_array", icon="CHECKMARK", text="").item = i
|
row.operator("bim.edit_array", icon="CHECKMARK", text="").item = i
|
||||||
row.operator("bim.disable_editing_array", icon="CANCEL", text="")
|
row.operator("bim.disable_editing_array", icon="CANCEL", text="")
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
|
row.prop(props, "dimension_input_type")
|
||||||
|
row = box.row(align=True)
|
||||||
row.prop(props, "use_local_space")
|
row.prop(props, "use_local_space")
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
row.prop(props, "x")
|
row.prop(props, "x")
|
||||||
@@ -236,6 +238,8 @@ class BIM_PT_array(bpy.types.Panel):
|
|||||||
row.operator("bim.enable_editing_array", icon="GREASEPENCIL", text="").item = i
|
row.operator("bim.enable_editing_array", icon="GREASEPENCIL", text="").item = i
|
||||||
row.operator("bim.remove_array", icon="X", text="").item = i
|
row.operator("bim.remove_array", icon="X", text="").item = i
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
|
row.label(text=f"Dimension input type: {array.get('dimension_input_type', 'Increment')}")
|
||||||
|
row = box.row(align=True)
|
||||||
row.label(text=f"Use Local Space: {array.get('use_local_space', False)}")
|
row.label(text=f"Use Local Space: {array.get('use_local_space', False)}")
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
row.label(text=f"X: {array['x']}")
|
row.label(text=f"X: {array['x']}")
|
||||||
|
|||||||
@@ -419,7 +419,11 @@ class Model(blenderbim.core.tool.Model):
|
|||||||
total_existing_children = len(array["children"])
|
total_existing_children = len(array["children"])
|
||||||
children_elements = []
|
children_elements = []
|
||||||
children_objs = []
|
children_objs = []
|
||||||
base_offset = Vector([array["x"], array["y"], array["z"]]) * unit_scale
|
if array['dimension_input_type'] == "Total":
|
||||||
|
divider = array["count"] -1
|
||||||
|
base_offset = Vector([array["x"] / divider, array["y"] / divider, array["z"] / divider]) * unit_scale
|
||||||
|
else:
|
||||||
|
base_offset = Vector([array["x"], array["y"], array["z"]]) * unit_scale
|
||||||
for i in range(array["count"]):
|
for i in range(array["count"]):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user