You can now assign objects to the selected container in the spatial decomposition panel

This commit is contained in:
Dion Moult
2024-09-01 08:13:29 +10:00
parent b476cb825c
commit 53a78f38e5
2 changed files with 13 additions and 7 deletions
@@ -78,14 +78,18 @@ class AssignContainer(bpy.types.Operator, tool.Ifc.Operator):
bl_label = "Assign Container"
bl_description = "Assign current default container to the selected objects"
bl_options = {"REGISTER", "UNDO"}
container: bpy.props.IntProperty(options={"SKIP_SAVE"})
def _execute(self, context):
props = context.active_object.BIMObjectSpatialProperties
if (container_obj := props.container_obj) and (container := tool.Ifc.get_entity(container_obj)):
for element_obj in context.selected_objects:
core.assign_container(
tool.Ifc, tool.Collector, tool.Spatial, container=container, element_obj=element_obj
)
if self.container:
container = tool.Ifc.get().by_id(self.container)
elif (container_obj := props.container_obj) and (container := tool.Ifc.get_entity(container_obj)):
pass
for element_obj in context.selected_objects:
core.assign_container(
tool.Ifc, tool.Collector, tool.Spatial, container=container, element_obj=element_obj
)
class EnableEditingContainer(bpy.types.Operator, tool.Ifc.Operator):
+4 -2
View File
@@ -159,16 +159,18 @@ class BIM_PT_spatial_decomposition(Panel):
if not self.props.total_elements:
row = self.layout.row(align=True)
row.label(text=f"{self.props.active_container.ifc_class} > No Contained Elements", icon="FILE_3D")
row.label(text=f"{self.props.active_container.ifc_class} > No Elements", icon="FILE_3D")
row.prop(self.props, "should_include_children", text="", icon="OUTLINER")
row.operator("bim.assign_container", icon="FOLDER_REDIRECT", text="").container = ifc_definition_id
return
row = self.layout.row(align=True)
row.label(
text=f"{self.props.active_container.ifc_class} > {self.props.total_elements} Contained Elements",
text=f"{self.props.active_container.ifc_class} > {self.props.total_elements} Elements",
icon="FILE_3D",
)
row.prop(self.props, "should_include_children", text="", icon="OUTLINER")
row.operator("bim.assign_container", icon="FOLDER_REDIRECT", text="").container = ifc_definition_id
op = row.operator("bim.select_decomposed_elements", icon="RESTRICT_SELECT_OFF", text="")
op.container = ifc_definition_id