def selectedOrAllToolControllers(self): tools = self.selectedOrAllTools() userinput = PathUtilsGui.PathUtilsUserInput() job = userinput.chooseJob(PathUtilsGui.PathUtils.GetJobs()) for tool in tools: print(tool) tc = PathToolControllerGui.Create(tool[1].Label, tool[1], tool[0]) job.Proxy.addToolController(tc) FreeCAD.ActiveDocument.recompute()
def Execute(cls, job): import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui import PathScripts.PathToolControllerGui as PathToolControllerGui library = PathToolBitLibraryGui.ToolBitLibrary() if 1 == library.open() and job: for nr, tool in library.selectedOrAllTools(): tc = PathToolControllerGui.Create("TC: {}".format(tool.Label), tool, nr) job.Proxy.addToolController(tc) FreeCAD.ActiveDocument.recompute() return True return False
def selectedOrAllToolControllers(self, index=None): ''' if no jobs, don't do anything, otherwise all TCs for all selected toolbits ''' jobs = PathUtilsGui.PathUtils.GetJobs() if len(jobs) == 0: return elif len(jobs) == 1: job = jobs[0] else: userinput = PathUtilsGui.PathUtilsUserInput() job = userinput.chooseJob(jobs) if job is None: # user may have canceled return tools = self.selectedOrAllTools() for tool in tools: tc = PathToolControllerGui.Create(tool[1].Label, tool[1], tool[0]) job.Proxy.addToolController(tc) FreeCAD.ActiveDocument.recompute()