From 7f81ec45d9f725aab0c9ca77157e7603440bee7e Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Wed, 26 Jul 2017 18:58:02 -0700 Subject: [PATCH] Fix PathJob creation through the console. --- src/Mod/Path/PathScripts/PathJob.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index e0b7603a41..909f5c506b 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -118,7 +118,7 @@ class ObjectPathJob: obj.Description = job.get(JobTemplate.Description) for tc in tree.getroot().iter(JobTemplate.ToolController): PathToolController.CommandPathToolController.FromTemplate(obj, tc) - elif template is not None: + else: PathToolController.CommandPathToolController.Create(obj.Name) def templateAttrs(self, obj): @@ -445,10 +445,13 @@ class CommandJobCreate: def Execute(cls, base, template): FreeCADGui.addModule('PathScripts.PathJob') FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Create Job")) - snippet = '''App.ActiveDocument.addObject("Path::FeatureCompoundPython", "Job") -PathScripts.PathJob.ObjectPathJob(App.ActiveDocument.ActiveObject, App.ActiveDocument.%s, "%s")''' % (base.Name, template) try: - FreeCADGui.doCommand(snippet) + FreeCADGui.doCommand('App.ActiveDocument.addObject("Path::FeatureCompoundPython", "Job")') + if template: + template = "'%s'" % template + else: + template = 'None' + FreeCADGui.doCommand('PathScripts.PathJob.ObjectPathJob(App.ActiveDocument.ActiveObject, App.ActiveDocument.%s, %s)' % (base.Name, template)) FreeCAD.ActiveDocument.commitTransaction() except: PathLog.error(sys.exc_info())