From: daid Date: Thu, 19 Apr 2012 14:31:39 +0000 (+0200) Subject: Updated project planner to use an alteration file between each print. X-Git-Tag: RC3~46 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5a721aaeb872fea60ce519023fe32ebc4e5584d5;p=cura.git Updated project planner to use an alteration file between each print. --- diff --git a/Cura/alterations/nextobject.gcode b/Cura/alterations/nextobject.gcode new file mode 100644 index 00000000..e32a40d9 --- /dev/null +++ b/Cura/alterations/nextobject.gcode @@ -0,0 +1,8 @@ +;Move to next object on the platform. clear_z is the minimal z height we need to make sure we do not hit any objects. +G92 E0 +G1 Z{clear_z} E-5 F{max_z_speed} +G92 E0 +G1 X{machine_center_x} Y{machine_center_y} F{travel_speed} +G1 F200 E7.5 +G1 Z0 F{max_z_speed} + diff --git a/Cura/gui/projectPlanner.py b/Cura/gui/projectPlanner.py index c6c5f05c..0822a44a 100644 --- a/Cura/gui/projectPlanner.py +++ b/Cura/gui/projectPlanner.py @@ -217,23 +217,34 @@ class projectPlanner(wx.Frame): #Restore the old profile. profile.loadGlobalProfileFromString(oldProfile) - resultFile = open("D:/Printing/result_export.gcode", "w") - resultFile.write(';TYPE:CUSTOM\n') - resultFile.write(profile.getAlterationFileContents('start.gcode')) + dlg=wx.FileDialog(self, "Save project gcode file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE) + dlg.SetWildcard("GCode file (*.gcode)|*.gcode") + if dlg.ShowModal() != wx.ID_OK: + dlg.Destroy() + return + resultFile = open(dlg.GetPath(), "w") + dlg.Destroy() + i = 1 maxZ = 0 prevItem = None for item in self.list: subprocess.call(item.sliceCmd) - if prevItem != None: + maxZ = max(maxZ, item.getMaximum().z * item.scale) + put('machine_center_x', item.centerX) + put('machine_center_y', item.centerY) + put('clear_z', maxZ) + + if prevItem == None: + resultFile.write(';TYPE:CUSTOM\n') + resultFile.write(profile.getAlterationFileContents('start.gcode')) + else: #reset the extrusion length, and move to the next object center. - resultFile.write(';PRINTNR:%d\n' % (i)) resultFile.write(';TYPE:CUSTOM\n') - resultFile.write('G1 Z%f F%f\n' % (maxZ + 5, profile.getProfileSettingFloat('travel_speed') * 60)) - resultFile.write('G92 E0\n') - resultFile.write('G1 X%f Y%f F%f\n' % (item.centerX, item.centerY, profile.getProfileSettingFloat('travel_speed') * 60)) - resultFile.write('G1 Z0 F%f\n' % (profile.getProfileSettingFloat('max_z_speed') * 60)) + resultFile.write(profile.getAlterationFileContents('nextobject.gcode')) + resultFile.write(';PRINTNR:%d\n' % (i)) + profile.loadGlobalProfileFromString(oldProfile) f = open(item.filename[: item.filename.rfind('.')] + "_export.project_tmp", "r") data = f.read(4096) @@ -245,7 +256,6 @@ class projectPlanner(wx.Frame): i += 1 prevItem = item - maxZ = max(maxZ, item.getMaximum().z * item.scale) resultFile.write(';TYPE:CUSTOM\n') resultFile.write(profile.getAlterationFileContents('end.gcode'))