mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
constraint.unassign_constraint - support batching #4474
This commit is contained in:
@@ -205,18 +205,16 @@ class UnassignConstraint(bpy.types.Operator):
|
||||
return IfcStore.execute_ifc_operator(self, context)
|
||||
|
||||
def _execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
self.file = tool.Ifc.get()
|
||||
objs = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects
|
||||
for obj in objs:
|
||||
obj_id = obj.BIMObjectProperties.ifc_definition_id
|
||||
if not obj_id:
|
||||
continue
|
||||
products = [self.file.by_id(obj_id) for obj in objs if (obj_id := obj.BIMObjectProperties.ifc_definition_id)]
|
||||
if products:
|
||||
ifcopenshell.api.run(
|
||||
"constraint.unassign_constraint",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(obj_id),
|
||||
"products": products,
|
||||
"constraint": self.file.by_id(self.constraint),
|
||||
}
|
||||
},
|
||||
)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -206,7 +206,7 @@ def remove_usage_constraint(ifc, resource_tool, resource, reference_path):
|
||||
reference = resource_tool.get_metric_reference(metric, is_deep=True)
|
||||
if reference == reference_path:
|
||||
ifc.run("constraint.remove_metric", metric=metric)
|
||||
ifc.run("constraint.unassign_constraint", product=resource, constraint=constraint)
|
||||
ifc.run("constraint.unassign_constraint", products=[resource], constraint=constraint)
|
||||
ifc.run("constraint.remove_constraint", constraint=constraint)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user