mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Assign / Unassign Document executes on all selected objects
This commit is contained in:
@@ -276,17 +276,21 @@ class AssignDocument(bpy.types.Operator):
|
|||||||
return IfcStore.execute_ifc_operator(self, context)
|
return IfcStore.execute_ifc_operator(self, context)
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
|
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
ifcopenshell.api.run(
|
objs = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects
|
||||||
"document.assign_document",
|
for obj in objs:
|
||||||
self.file,
|
obj_id = obj.BIMObjectProperties.ifc_definition_id
|
||||||
**{
|
if not obj_id:
|
||||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
continue
|
||||||
"document": self.file.by_id(self.document),
|
ifcopenshell.api.run(
|
||||||
}
|
"document.assign_document",
|
||||||
)
|
self.file,
|
||||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
**{
|
||||||
|
"product": self.file.by_id(obj_id),
|
||||||
|
"document": self.file.by_id(self.document),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Data.load(self.file, obj_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -301,15 +305,19 @@ class UnassignDocument(bpy.types.Operator):
|
|||||||
return IfcStore.execute_ifc_operator(self, context)
|
return IfcStore.execute_ifc_operator(self, context)
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
|
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
ifcopenshell.api.run(
|
objs = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects
|
||||||
"document.unassign_document",
|
for obj in objs:
|
||||||
self.file,
|
obj_id = obj.BIMObjectProperties.ifc_definition_id
|
||||||
**{
|
if not obj_id:
|
||||||
"product": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id),
|
continue
|
||||||
"document": self.file.by_id(self.document),
|
ifcopenshell.api.run(
|
||||||
}
|
"document.unassign_document",
|
||||||
)
|
self.file,
|
||||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
**{
|
||||||
|
"product": self.file.by_id(obj_id),
|
||||||
|
"document": self.file.by_id(self.document),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Data.load(self.file, obj_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
Reference in New Issue
Block a user