mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Minor array refactor
This commit is contained in:
@@ -36,8 +36,7 @@ class AddArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
array = {"children": [], "count": 1, "x": 0.0, "y": 0.0, "z": 0.0}
|
||||
|
||||
psets = ifcopenshell.util.element.get_psets(element)
|
||||
pset = psets.get("BBIM_Array", None)
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||
|
||||
if pset:
|
||||
data = json.loads(pset["Data"])
|
||||
@@ -77,8 +76,7 @@ class EditArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMArrayProperties
|
||||
|
||||
psets = ifcopenshell.util.element.get_psets(element)
|
||||
pset = psets["BBIM_Array"]
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||
data = json.loads(pset["Data"])
|
||||
data[self.item] = {
|
||||
"children": data[self.item]["children"],
|
||||
@@ -112,8 +110,7 @@ class EnableEditingArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
def _execute(self, context):
|
||||
obj = context.active_object
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
psets = ifcopenshell.util.element.get_psets(element)
|
||||
data = json.loads(psets["BBIM_Array"]["Data"])[self.item]
|
||||
data = json.loads(ifcopenshell.util.element.get_pset(element, "BBIM_Array", "Data"))[self.item]
|
||||
props = obj.BIMArrayProperties
|
||||
props.count = data["count"]
|
||||
props.x = data["x"]
|
||||
@@ -134,8 +131,7 @@ class RemoveArray(bpy.types.Operator, tool.Ifc.Operator):
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMArrayProperties
|
||||
|
||||
psets = ifcopenshell.util.element.get_psets(element)
|
||||
pset = psets["BBIM_Array"]
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||
data = json.loads(pset["Data"])
|
||||
data[self.item]["count"] = 1
|
||||
|
||||
|
||||
@@ -372,10 +372,11 @@ class Model(blenderbim.core.tool.Model):
|
||||
total_existing_children = len(array["children"])
|
||||
children_elements = []
|
||||
children_objs = []
|
||||
base_offset = Vector([array["x"], array["y"], array["z"]]) * unit_scale
|
||||
for i in range(0, array["count"]):
|
||||
if i == 0:
|
||||
continue
|
||||
offset = Vector((i * array["x"] * unit_scale, i * array["y"] * unit_scale, i * array["z"] * unit_scale))
|
||||
offset = base_offset * i
|
||||
for obj in obj_stack:
|
||||
if child_i >= total_existing_children:
|
||||
child_obj = tool.Spatial.duplicate_object_and_data(obj)
|
||||
|
||||
Reference in New Issue
Block a user