def Activated(self): """When entering the workbench.""" if hasattr(FreeCADGui, "draftToolBar"): FreeCADGui.draftToolBar.Activated() if hasattr(FreeCADGui, "Snapper"): FreeCADGui.Snapper.show() import draftutils.init_draft_statusbar as dsb dsb.show_draft_statusbar() FreeCAD.Console.PrintLog("Draft workbench activated.\n")
def Activated(self): try: import WorkingPlane from plane import Grid as gr from plane import DocObserver if (self.myDocObserver is None): self.myDocObserver = DocObserver() self.myDocObserver.setLink(self) App.addDocumentObserver(self.myDocObserver) if not (App.ActiveDocument): App.newDocument() Gui.ActiveDocument.ActiveView.setCameraType("Perspective") # FROM DRAFT if hasattr(FreeCADGui, "draftToolBar"): Gui.draftToolBar.Activated() if hasattr(FreeCADGui, "Snapper"): Gui.Snapper.show() import draftutils.init_draft_statusbar as dsb dsb.show_draft_statusbar() # Fix the view of the grid make it as 123D Design App.DraftWorkingPlane.alignToPointAndAxis( App.Vector(0.0, 0.0, 0.0), App.Vector(0, 0, 1), 0.0) # Show the Grid always # g=gridTracker() v = Gui.ActiveDocument.ActiveView # New plane axis 2021-03-22 if (self.planeShow is None): self.planeShow = gr(v) self.planeShow.Activated() # g.ff() #draft Grid --> I will try to remove it in the future Mariwan 2021-03-22 # Show Top view - Isometric always if self.runOnce == True: Gui.ActiveDocument.activeView().viewTop() Gui.activeDocument().activeView().viewIsometric() # Gui.SendMsgToActiveView("ViewFit") for TT in range(1, 10): Gui.ActiveDocument.ActiveView.zoomOut() self.runOnce = False App.Console.PrintLog( "Draft workbench activated Inside Design456.\n") # Turn OFF grid #TODO:Make This permanent Gui.Snapper.grid.off() App.Console.PrintMessage('Design456 workbench loaded\n') return except Exception as err: App.Console.PrintError("'Error: Design456 activation' Failed.\n" "Design456 will not work as expected.\n " "{err}\n".format(err=str(err))) exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno)
def Activated(self): try: import WorkingPlane #from draftguitools.gui_trackers import gridTracker from plane import Grid as gr if not(App.ActiveDocument): App.newDocument() # FROM DRAFT if hasattr(FreeCADGui, "draftToolBar"): Gui.draftToolBar.Activated() if hasattr(FreeCADGui, "Snapper"): Gui.Snapper.show() import draftutils.init_draft_statusbar as dsb dsb.show_draft_statusbar() # Fix the view of the grid make it as 123D Design App.DraftWorkingPlane.alignToPointAndAxis( App.Vector(0.0, 0.0, 0.0), App.Vector(0, 0, 1), 0.0) # Show the Grid always #g=gridTracker() v=Gui.ActiveDocument.ActiveView #New plane axis 2021-03-22 planeShow=gr(v) planeShow.Activated() #g.ff() #draft Grid --> I will try to remove it in the future Mariwan 2021-03-22 #Show Top view - Isometric always if self.runOnce==True: Gui.activeDocument().activeView().viewTop() Gui.activeDocument().activeView().viewIsometric() # Gui.SendMsgToActiveView("ViewFit") for x in range(1, 10): Gui.ActiveDocument.ActiveView.zoomOut() self.runOnce=False App.Console.PrintLog( "Draft workbench activated Inside Design456.\n") #Turn OFF grid #TODO:Make This permanent Gui.Snapper.grid.off() App.Console.PrintMessage('Design456 workbench loaded\n') return except Exception as exc: App.Console.PrintError(exc) App.Console.PrintError("Error: Draft activation " "failed, " "Draft will not work as expected.\n")
def Activated(self): try: import WorkingPlane from draftguitools.gui_trackers import gridTracker if not (App.ActiveDocument): App.newDocument() # FROM DRAFT if hasattr(FreeCADGui, "draftToolBar"): Gui.draftToolBar.Activated() if hasattr(FreeCADGui, "Snapper"): Gui.Snapper.show() import draftutils.init_draft_statusbar as dsb dsb.show_draft_statusbar() # Fix the view of the grid make it as 123D Design App.DraftWorkingPlane.alignToPointAndAxis( App.Vector(0.0, 0.0, 0.0), App.Vector(0, 0, 1), 0.0) # Show the Grid always g = gridTracker() g.on() #Show Top view - Isometric always if self.runOnce == True: Gui.activeDocument().activeView().viewTop() Gui.activeDocument().activeView().viewIsometric() Gui.SendMsgToActiveView("ViewFit") for x in range(1, 6): Gui.ActiveDocument.ActiveView.zoomOut() self.runOnce = False App.Console.PrintLog( "Draft workbench activated Inside Design456.\n") App.Console.PrintMessage('Design456 workbench loaded\n') return except Exception as exc: App.Console.PrintError(exc) App.Console.PrintError("Error: Draft activation " "failed, " "Draft will not work as expected.\n")