From be62ecc02391d1df1552d216449329e45b4d4ac8 Mon Sep 17 00:00:00 2001 From: Furgo <148809153+furgo16@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:36:52 +0200 Subject: [PATCH] BIM: group 2D view creation commands --- src/Mod/BIM/InitGui.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/Mod/BIM/InitGui.py b/src/Mod/BIM/InitGui.py index 0edccbb1a5..084bffd9dc 100644 --- a/src/Mod/BIM/InitGui.py +++ b/src/Mod/BIM/InitGui.py @@ -103,13 +103,16 @@ class BIMWorkbench(Workbench): "Arch_AxisSystem", "Arch_Grid", "Arch_SectionPlane", - "BIM_DrawingView", - "BIM_Shape2DView", - "BIM_Shape2DCut", "BIM_TDPage", "BIM_TDView", ] + self.create_2dviews = [ + "BIM_DrawingView", + "BIM_Shape2DView", + "BIM_Shape2DCut", + ] + self.bimtools = [ "BIM_Project", "Arch_Site", @@ -255,7 +258,6 @@ class BIMWorkbench(Workbench): ] # create generic tools command - class BIM_GenericTools: def __init__(self, tools): self.tools = tools @@ -270,6 +272,22 @@ class BIMWorkbench(Workbench): FreeCADGui.addCommand("BIM_GenericTools", BIM_GenericTools(self.generictools)) self.bimtools.append("BIM_GenericTools") + # create create 2D views command + class BIM_Create2DViews: + def __init__(self, tools): + self.tools = tools + def GetCommands(self): + return self.tools + def GetResources(self): + t = QT_TRANSLATE_NOOP("BIM_Create2DViews", "Create 2D views") + return { "MenuText": t, "ToolTip": t, "Icon": "BIM_DrawingView"} + def IsActive(self): + v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph") + return v + FreeCADGui.addCommand("BIM_Create2DViews", BIM_Create2DViews(self.create_2dviews)) + insert_at_index = self.annotationtools.index("BIM_TDPage") + self.annotationtools.insert(insert_at_index, "BIM_Create2DViews") + # load rebar tools (Reinforcement addon) try: