#Restore the old profile.\r
profile.loadGlobalProfileFromString(oldProfile)\r
\r
- resultFile = open("D:/Printing/result_export.gcode", "w")\r
- resultFile.write(';TYPE:CUSTOM\n')\r
- resultFile.write(profile.getAlterationFileContents('start.gcode'))\r
+ dlg=wx.FileDialog(self, "Save project gcode file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)\r
+ dlg.SetWildcard("GCode file (*.gcode)|*.gcode")\r
+ if dlg.ShowModal() != wx.ID_OK:\r
+ dlg.Destroy()\r
+ return\r
+ resultFile = open(dlg.GetPath(), "w")\r
+ dlg.Destroy()\r
+ \r
i = 1\r
maxZ = 0\r
prevItem = None\r
for item in self.list:\r
subprocess.call(item.sliceCmd)\r
\r
- if prevItem != None:\r
+ maxZ = max(maxZ, item.getMaximum().z * item.scale)\r
+ put('machine_center_x', item.centerX)\r
+ put('machine_center_y', item.centerY)\r
+ put('clear_z', maxZ)\r
+ \r
+ if prevItem == None:\r
+ resultFile.write(';TYPE:CUSTOM\n')\r
+ resultFile.write(profile.getAlterationFileContents('start.gcode'))\r
+ else:\r
#reset the extrusion length, and move to the next object center.\r
- resultFile.write(';PRINTNR:%d\n' % (i))\r
resultFile.write(';TYPE:CUSTOM\n')\r
- resultFile.write('G1 Z%f F%f\n' % (maxZ + 5, profile.getProfileSettingFloat('travel_speed') * 60))\r
- resultFile.write('G92 E0\n')\r
- resultFile.write('G1 X%f Y%f F%f\n' % (item.centerX, item.centerY, profile.getProfileSettingFloat('travel_speed') * 60))\r
- resultFile.write('G1 Z0 F%f\n' % (profile.getProfileSettingFloat('max_z_speed') * 60))\r
+ resultFile.write(profile.getAlterationFileContents('nextobject.gcode'))\r
+ resultFile.write(';PRINTNR:%d\n' % (i))\r
+ profile.loadGlobalProfileFromString(oldProfile)\r
\r
f = open(item.filename[: item.filename.rfind('.')] + "_export.project_tmp", "r")\r
data = f.read(4096)\r
i += 1\r
\r
prevItem = item\r
- maxZ = max(maxZ, item.getMaximum().z * item.scale)\r
\r
resultFile.write(';TYPE:CUSTOM\n')\r
resultFile.write(profile.getAlterationFileContents('end.gcode'))\r