You can now make the selected element in the spatial decomposition panel active

This commit is contained in:
Dion Moult
2024-09-02 20:37:04 +10:00
parent 1a8be005cf
commit fb422692c8
4 changed files with 21 additions and 0 deletions
@@ -33,6 +33,7 @@ classes = (
operator.ReferenceStructure,
operator.RemoveContainer,
operator.SelectContainer,
operator.SelectDecomposedElement,
operator.SelectDecomposedElements,
operator.SelectProduct,
operator.SelectSimilarContainer,
@@ -265,6 +265,17 @@ class ToggleContainerElement(bpy.types.Operator):
return {"FINISHED"}
class SelectDecomposedElement(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.select_decomposed_element"
bl_label = "Select Decomposed Element"
bl_options = {"REGISTER", "UNDO"}
element: bpy.props.IntProperty()
def _execute(self, context):
if self.element:
core.select_decomposed_element(tool.Ifc, tool.Spatial, element=tool.Ifc.get().by_id(self.element))
class SelectDecomposedElements(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.select_decomposed_elements"
bl_label = "Select Children"
@@ -171,6 +171,11 @@ class BIM_PT_spatial_decomposition(Panel):
)
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_element", icon="OBJECT_DATA", text="")
if active_element := self.props.active_element:
op.element = active_element.ifc_definition_id
else:
op.element = 0
op = row.operator("bim.select_decomposed_elements", icon="RESTRICT_SELECT_OFF", text="")
op.container = ifc_definition_id
+4
View File
@@ -159,6 +159,10 @@ def select_decomposed_elements(
spatial.select_products(elements)
def select_decomposed_element(ifc: tool.Ifc, spatial: tool.Spatial, element: ifcopenshell.entity_instance) -> None:
spatial.set_active_object(ifc.get_object(element))
def generate_space(ifc: tool.Ifc, model: tool.Model, root: tool.Root, spatial: tool.Spatial, type: tool.Type) -> None:
if not root.get_default_container():
raise NoDefaultContainer()