mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 20:26:22 +00:00
Groups/Systems UI - expand parent group when child group is added
So user can immediately see the added item, it seems more intuitive.
This commit is contained in:
@@ -87,9 +87,9 @@ class AddGroup(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
result = ifcopenshell.api.group.add_group(tool.Ifc.get())
|
result = ifcopenshell.api.group.add_group(tool.Ifc.get())
|
||||||
if self.group:
|
if self.group:
|
||||||
ifcopenshell.api.group.assign_group(
|
group = tool.Ifc.get().by_id(self.group)
|
||||||
tool.Ifc.get(), products=[result], group=tool.Ifc.get().by_id(self.group)
|
ifcopenshell.api.group.assign_group(tool.Ifc.get(), products=[result], group=group)
|
||||||
)
|
tool.Group.toggle_group(group, "IfcGroup", "EXPAND")
|
||||||
tool.Group.import_groups("IfcGroup")
|
tool.Group.import_groups("IfcGroup")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class AddSystem(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
props = tool.System.get_system_props()
|
props = tool.System.get_system_props()
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
parent_system = None if self.parent_system_id == 0 else ifc_file.by_id(self.parent_system_id)
|
parent_system = None if self.parent_system_id == 0 else ifc_file.by_id(self.parent_system_id)
|
||||||
core.add_system(tool.Ifc, tool.System, ifc_class=props.system_class, parent_system=parent_system)
|
core.add_system(tool.Ifc, tool.Group, tool.System, ifc_class=props.system_class, parent_system=parent_system)
|
||||||
|
|
||||||
|
|
||||||
class EditSystem(bpy.types.Operator, tool.Ifc.Operator):
|
class EditSystem(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ def disable_system_editing_ui(system: type[tool.System]) -> None:
|
|||||||
|
|
||||||
def add_system(
|
def add_system(
|
||||||
ifc: type[tool.Ifc],
|
ifc: type[tool.Ifc],
|
||||||
|
group: type[tool.Group],
|
||||||
system: type[tool.System],
|
system: type[tool.System],
|
||||||
ifc_class: str,
|
ifc_class: str,
|
||||||
parent_system: Union[ifcopenshell.entity_instance, None],
|
parent_system: Union[ifcopenshell.entity_instance, None],
|
||||||
@@ -45,6 +46,8 @@ def add_system(
|
|||||||
new_system = ifc.run("system.add_system", ifc_class=ifc_class)
|
new_system = ifc.run("system.add_system", ifc_class=ifc_class)
|
||||||
if parent_system:
|
if parent_system:
|
||||||
ifc.run("group.assign_group", products=[new_system], group=parent_system)
|
ifc.run("group.assign_group", products=[new_system], group=parent_system)
|
||||||
|
group.toggle_group(parent_system, "IfcSystem", "EXPAND")
|
||||||
|
|
||||||
system.import_systems()
|
system.import_systems()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user