fix for not being able to use the post code icon
This commit is contained in:
parent
3565d4ef18
commit
2e44b6c41b
|
@ -162,6 +162,28 @@ class CommandPathPost:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def exportObjectsWith(self, objs, job, needFilename = True):
|
||||||
|
# check if the user has a project and has set the default post and
|
||||||
|
# output filename
|
||||||
|
postArgs = PathPreferences.defaultPostProcessorArgs()
|
||||||
|
if hasattr(job, "PostProcessorArgs") and job.PostProcessorArgs:
|
||||||
|
postArgs = job.PostProcessorArgs
|
||||||
|
elif hasattr(job, "PostProcessor") and job.PostProcessor:
|
||||||
|
postArgs = ''
|
||||||
|
|
||||||
|
postname = self.resolvePostProcessor(job)
|
||||||
|
filename = '-'
|
||||||
|
if postname and needFilename:
|
||||||
|
filename = self.resolveFileName(job)
|
||||||
|
|
||||||
|
if postname and filename:
|
||||||
|
print("post: %s(%s, %s)" % (postname, filename, postArgs))
|
||||||
|
processor = PostProcessor.load(postname)
|
||||||
|
gcode = processor.export(objs, filename, postArgs)
|
||||||
|
return (False, gcode)
|
||||||
|
else:
|
||||||
|
return (True, '')
|
||||||
|
|
||||||
def Activated(self):
|
def Activated(self):
|
||||||
FreeCAD.ActiveDocument.openTransaction(
|
FreeCAD.ActiveDocument.openTransaction(
|
||||||
translate("Path_Post", "Post Process the Selected path(s)"))
|
translate("Path_Post", "Post Process the Selected path(s)"))
|
||||||
|
@ -187,7 +209,7 @@ class CommandPathPost:
|
||||||
else:
|
else:
|
||||||
job = jobs.pop()
|
job = jobs.pop()
|
||||||
print("Job for selected objects = %s" % job.Name)
|
print("Job for selected objects = %s" % job.Name)
|
||||||
(fail, rc) = exportObjectsWith(selected, job)
|
(fail, rc) = self.exportObjectsWith(selected, job)
|
||||||
|
|
||||||
if fail:
|
if fail:
|
||||||
FreeCAD.ActiveDocument.abortTransaction()
|
FreeCAD.ActiveDocument.abortTransaction()
|
||||||
|
@ -195,27 +217,7 @@ class CommandPathPost:
|
||||||
FreeCAD.ActiveDocument.commitTransaction()
|
FreeCAD.ActiveDocument.commitTransaction()
|
||||||
FreeCAD.ActiveDocument.recompute()
|
FreeCAD.ActiveDocument.recompute()
|
||||||
|
|
||||||
def exportObjectsWith(self, objs, job, needFilename = True):
|
|
||||||
# check if the user has a project and has set the default post and
|
|
||||||
# output filename
|
|
||||||
postArgs = PathPreferences.defaultPostProcessorArgs()
|
|
||||||
if hasattr(job, "PostProcessorArgs") and job.PostProcessorArgs:
|
|
||||||
postArgs = job.PostProcessorArgs
|
|
||||||
elif hasattr(job, "PostProcessor") and job.PostProcessor:
|
|
||||||
postArgs = ''
|
|
||||||
|
|
||||||
postname = self.resolvePostProcessor(job)
|
|
||||||
filename = '-'
|
|
||||||
if postname and needFilename:
|
|
||||||
filename = self.resolveFileName(job)
|
|
||||||
|
|
||||||
if postname and filename:
|
|
||||||
print("post: %s(%s, %s)" % (postname, filename, postArgs))
|
|
||||||
processor = PostProcessor.load(postname)
|
|
||||||
gcode = processor.export(objs, filename, postArgs)
|
|
||||||
return (False, gcode)
|
|
||||||
else:
|
|
||||||
return (True, '')
|
|
||||||
|
|
||||||
if FreeCAD.GuiUp:
|
if FreeCAD.GuiUp:
|
||||||
# register the FreeCAD command
|
# register the FreeCAD command
|
||||||
|
|
Loading…
Reference in New Issue
Block a user