MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / _execute

Method _execute

src/bonsai/bonsai/bim/module/model/array.py:133–165  ·  view source on GitHub ↗
(self, context)

Source from the content-addressed store, hash-verified

131 item: bpy.props.IntProperty()
132
133 def _execute(self, context):
134 obj = context.active_object
135 element = tool.Ifc.get_entity(obj)
136 props = tool.Model.get_array_props(obj)
137 si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
138
139 pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
140 data = json.loads(pset["Data"])
141 data[self.item] = {
142 "children": data[self.item]["children"],
143 "count": props.count,
144 "x": props.x / si_conversion,
145 "y": props.y / si_conversion,
146 "z": props.z / si_conversion,
147 "use_local_space": props.use_local_space,
148 "method": props.method,
149 }
150
151 props.is_editing = -1
152
153 try:
154 parent_element = tool.Ifc.get().by_guid(pset["Parent"])
155 parent = tool.Ifc.get_object(parent_element)
156 except:
157 return {"FINISHED"}
158
159 tool.Blender.Modifier.Array.remove_constraints(parent_element)
160 tool.Model.regenerate_array(parent, data)
161 tool.Blender.Modifier.Array.set_children_lock_state(element, self.item, True)
162 tool.Blender.Modifier.Array.constrain_children_to_parent(element)
163
164 # clears the relating_array_object so it doesn't show again next time
165 props.relating_array_object = None
166
167
168class ApplyArray(bpy.types.Operator, tool.Ifc.Operator):

Callers

nothing calls this directly

Calls 10

get_array_propsMethod · 0.80
calculate_unit_scaleMethod · 0.80
remove_constraintsMethod · 0.80
get_entityMethod · 0.45
getMethod · 0.45
by_guidMethod · 0.45
get_objectMethod · 0.45
regenerate_arrayMethod · 0.45

Tested by

no test coverage detected