engine.wait()
if not options.output:
- options.output = args[0] + '.gcode'
+ options.output = args[0] + profile.getGCodeExtension()
with open(options.output, "wb") as f:
f.write(engine.getResult().getGCode())
print 'GCode file saved : %s' % options.output
def OnLoadProfileFromGcode(self, e):
dlg=wx.FileDialog(self, _("Select gcode file to load profile from"), os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
- dlg.SetWildcard("gcode files (*.gcode)|*.gcode;*.g")
+ dlg.SetWildcard("gcode files (*%s)|*%s;*%s" % (profile.getGCodeExtension(), profile.getGCodeExtension(), profile.getGCodeExtension()[0:2]))
if dlg.ShowModal() == wx.ID_OK:
gcodeFile = dlg.GetPath()
f = open(gcodeFile, 'r')
dlg.Destroy()
else:
drive = drives[0]
- filename = self._scene._objectList[0].getName() + '.gcode'
+ filename = self._scene._objectList[0].getName() + profile.getGCodeExtension()
threading.Thread(target=self._saveGCode,args=(drive[1] + filename, drive[1])).start()
elif connectionGroup is not None:
connections = connectionGroup.getAvailableConnections()
if len(self._scene._objectList) < 1:
return
dlg=wx.FileDialog(self, _("Save toolpath"), os.path.dirname(profile.getPreference('lastFile')), style=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
- filename = self._scene._objectList[0].getName() + '.gcode'
+ filename = self._scene._objectList[0].getName() + profile.getGCodeExtension()
dlg.SetFilename(filename)
- dlg.SetWildcard('Toolpath (*.gcode)|*.gcode;*.g')
+ dlg.SetWildcard('Toolpath (*%s)|*%s;*%s' % (profile.getGCodeExtension(), profile.getGCodeExtension(), profile.getGCodeExtension()[0:2]))
if dlg.ShowModal() != wx.ID_OK:
dlg.Destroy()
return
return 2
return 1
+def getGCodeExtension():
+ if getMachineSetting('gcode_flavor') == 'BFB':
+ return '.bfb'
+ return '.gcode'
+
#########################################################
## Alteration file functions
#########################################################