BIM: Fixed IsActive of BIM commands (#14384)
This commit is contained in:
@@ -197,7 +197,8 @@ class CommandStructuresFromSelection:
|
||||
'ToolTip': QT_TRANSLATE_NOOP("Arch_StructuresFromSelection", "Create multiple Arch Structures from a selected base, using each selected edge as an extrusion path")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
selex = FreeCADGui.Selection.getSelectionEx()
|
||||
|
||||
@@ -246,7 +246,8 @@ class BIMWorkbench(Workbench):
|
||||
t = QT_TRANSLATE_NOOP("BIM_GenericTools", "Generic 3D tools")
|
||||
return { "MenuText": t, "ToolTip": t, "Icon": "BIM_Box"}
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
FreeCADGui.addCommand("BIM_GenericTools", BIM_GenericTools(self.generictools))
|
||||
self.bimtools.append("BIM_GenericTools")
|
||||
|
||||
@@ -274,7 +275,8 @@ class BIMWorkbench(Workbench):
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
FreeCADGui.addCommand("Arch_RebarTools", RebarGroupCommand())
|
||||
self.bimtools[self.bimtools.index("Arch_Rebar")] = "Arch_RebarTools"
|
||||
|
||||
@@ -37,6 +37,10 @@ class BIM_Beam(ArchStructure._CommandStructure):
|
||||
super().__init__()
|
||||
self.beammode = True
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def GetResources(self):
|
||||
return {
|
||||
"Pixmap": "BIM_Beam",
|
||||
|
||||
@@ -37,6 +37,10 @@ class BIM_Column(ArchStructure._CommandStructure):
|
||||
super().__init__()
|
||||
self.beammode = False
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def GetResources(self):
|
||||
return {
|
||||
"Pixmap": "BIM_Column",
|
||||
|
||||
@@ -42,6 +42,10 @@ class BIM_Common:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import PartGui
|
||||
FreeCADGui.runCommand("Part_Common")
|
||||
|
||||
@@ -42,6 +42,10 @@ class BIM_Compound:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import PartGui
|
||||
FreeCADGui.runCommand("Part_Compound")
|
||||
|
||||
@@ -41,6 +41,10 @@ class BIM_Cut:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import PartGui
|
||||
FreeCADGui.runCommand("Part_Cut")
|
||||
|
||||
@@ -40,6 +40,10 @@ class BIM_Extrude:
|
||||
"ToolTip": QT_TRANSLATE_NOOP("BIM_Extrude", "Extrudes a selected 2D shape"),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import PartGui
|
||||
FreeCADGui.runCommand("Part_Extrude")
|
||||
|
||||
@@ -39,6 +39,10 @@ class BIM_Fuse:
|
||||
"ToolTip": QT_TRANSLATE_NOOP("Part_Fuse", "Make a union of several shapes"),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import PartGui
|
||||
FreeCADGui.runCommand("Part_Fuse")
|
||||
|
||||
@@ -58,6 +58,10 @@ class BIM_Layers:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
@@ -60,6 +60,10 @@ class BIM_Material:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
|
||||
self.dlg = None
|
||||
|
||||
@@ -41,6 +41,10 @@ class BIM_Offset2D:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import PartGui
|
||||
FreeCADGui.runCommand("Part_Offset2D")
|
||||
|
||||
@@ -68,6 +68,10 @@ class BIM_Preflight:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
FreeCADGui.BIMPreflightDone = False
|
||||
FreeCADGui.Control.showDialog(BIM_Preflight_TaskPanel())
|
||||
|
||||
@@ -44,6 +44,10 @@ class BIM_Rewire:
|
||||
"Accel": "R,W",
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import Part
|
||||
import Draft
|
||||
|
||||
@@ -42,6 +42,10 @@ class BIM_SimpleCopy:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
import PartGui
|
||||
FreeCADGui.runCommand("Part_SimpleCopy")
|
||||
|
||||
@@ -41,6 +41,10 @@ class BIM_Windows:
|
||||
),
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
|
||||
return v
|
||||
|
||||
def Activated(self):
|
||||
FreeCADGui.Control.showDialog(BIM_Windows_TaskPanel())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user