Fixed ToolController creation when there are multiple jobs.

This commit is contained in:
Markus Lampert
2017-08-06 11:41:10 -07:00
committed by Yorik van Havre
parent ca8f827570
commit abe2a15a37
2 changed files with 4 additions and 4 deletions

View File

@@ -545,14 +545,14 @@ class EditorPanel():
for toolnum in tools:
tool = self.TLM.getTool(currList, int(toolnum))
PathLog.debug('tool: {}, toolnum: {}'.format(tool, toolnum))
for i in FreeCAD.ActiveDocument.findObjects("Path::Feature"):
if isinstance(i.Proxy, PathScripts.PathJob.ObjectPathJob) and i.Label == targetlist:
for job in FreeCAD.ActiveDocument.findObjects("Path::Feature"):
if isinstance(job.Proxy, PathScripts.PathJob.ObjectPathJob) and job.Label == targetlist:
label = "T{}: {}".format(toolnum, tool.Name)
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython",label)
PathScripts.PathToolController.ToolController(obj)
PathScripts.PathToolController._ViewProviderToolController(obj.ViewObject)
PathUtils.addToJob(obj, targetlist)
PathUtils.addToJob(obj, job.Name)
FreeCAD.activeDocument().recompute()
obj.Tool = tool.copy()
obj.ToolNumber = int(toolnum)

View File

@@ -465,7 +465,7 @@ def addToJob(obj, jobname=None):
if len(jobs) == 1:
job = jobs[0]
else:
FreeCAD.Console.PrintError("Didn't find the job")
PathLog.error("Didn't find job %s" % jobname)
return None
else:
jobs = GetJobs()