Beispiel #1
0
    def Activated(self):

        if hasattr(FreeCADGui,"draftToolBar"):
            FreeCADGui.draftToolBar.Activated()
        if hasattr(FreeCADGui,"Snapper"):
            FreeCADGui.Snapper.show()

        from DraftGui import todo
        import BimCommands

        if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM").GetBool("FirstTime",True):
            todo.delay(FreeCADGui.runCommand,"BIM_Welcome")
        todo.delay(BimCommands.setStatusIcons,True)

        if not hasattr(FreeCAD,"BimDocumentObserver"):
            FreeCAD.BimDocumentObserver = BimCommands.BimDocumentObserver()
            FreeCAD.addDocumentObserver(FreeCAD.BimDocumentObserver)
            Log("Adding FreeCAD.BimDocumentObserver\n")
        FreeCADGui.Control.clearTaskWatcher()

        class BimWatcher:

            def __init__(self,cmds,name,invert=False):

                self.commands = cmds
                self.title = name
                self.invert = invert

            def shouldShow(self):

                if self.invert:
                    return (FreeCAD.ActiveDocument != None) and (FreeCADGui.Selection.getSelection() != [])
                else:
                    return (FreeCAD.ActiveDocument != None) and (not FreeCADGui.Selection.getSelection())

        FreeCADGui.Control.addTaskWatcher([BimWatcher(self.draft+self.annotation,"2D geometry"),
                                           BimWatcher(self.arch,"3D/BIM geometry"),
                                           BimWatcher(self.modify,"Modify",invert=True)])

        # restore views widget if needed
        if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM").GetBool("RestoreBimViews",True):
            w = BimCommands.BimViews.findWidget()
            if not w:
                FreeCADGui.runCommand("BIM_Views")
            else:
                w.show()
                

        Log("BIM workbench activated\n")
Beispiel #2
0
    def Activated(self):

        if hasattr(FreeCADGui, "draftToolBar"):
            FreeCADGui.draftToolBar.Activated()
        if hasattr(FreeCADGui, "Snapper"):
            FreeCADGui.Snapper.show()
        from DraftGui import todo
        import BimCommands
        if FreeCAD.ParamGet(
                "User parameter:BaseApp/Preferences/Mod/BIM").GetBool(
                    "FirstTime", True):
            todo.delay(FreeCADGui.runCommand, "BIM_Welcome")
        todo.delay(BimCommands.setStatusIcons, True)
        if not hasattr(FreeCAD, "BimDocumentObserver"):
            FreeCAD.BimDocumentObserver = BimCommands.BimDocumentObserver()
            FreeCAD.addDocumentObserver(FreeCAD.BimDocumentObserver)
            Log("Adding FreeCAD.BimDocumentObserver\n")

        Log("BIM workbench activated\n")