diff --git a/src/bonsai/bonsai/bim/module/group/operator.py b/src/bonsai/bonsai/bim/module/group/operator.py index 3c8b120349..40c3e418a1 100644 --- a/src/bonsai/bonsai/bim/module/group/operator.py +++ b/src/bonsai/bonsai/bim/module/group/operator.py @@ -87,9 +87,9 @@ class AddGroup(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): result = ifcopenshell.api.group.add_group(tool.Ifc.get()) if self.group: - ifcopenshell.api.group.assign_group( - tool.Ifc.get(), products=[result], group=tool.Ifc.get().by_id(self.group) - ) + 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") return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/system/operator.py b/src/bonsai/bonsai/bim/module/system/operator.py index 3d1b88cb3a..add214c09d 100644 --- a/src/bonsai/bonsai/bim/module/system/operator.py +++ b/src/bonsai/bonsai/bim/module/system/operator.py @@ -67,7 +67,7 @@ class AddSystem(bpy.types.Operator, tool.Ifc.Operator): props = tool.System.get_system_props() ifc_file = tool.Ifc.get() 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): diff --git a/src/bonsai/bonsai/core/system.py b/src/bonsai/bonsai/core/system.py index d7d0bbebe0..fcdb95e72d 100644 --- a/src/bonsai/bonsai/core/system.py +++ b/src/bonsai/bonsai/core/system.py @@ -38,6 +38,7 @@ def disable_system_editing_ui(system: type[tool.System]) -> None: def add_system( ifc: type[tool.Ifc], + group: type[tool.Group], system: type[tool.System], ifc_class: str, 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) if parent_system: ifc.run("group.assign_group", products=[new_system], group=parent_system) + group.toggle_group(parent_system, "IfcSystem", "EXPAND") + system.import_systems()