Updated project planner to use an alteration file between each print.

This commit is contained in:
daid 2012-04-19 16:31:39 +02:00
parent 67e12946ed
commit 5a721aaeb8
2 changed files with 29 additions and 11 deletions

View File

@ -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}

View File

@ -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:
#reset the extrusion length, and move to the next object center.
resultFile.write(';PRINTNR:%d\n' % (i))
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('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('start.gcode'))
else:
#reset the extrusion length, and move to the next object center.
resultFile.write(';TYPE:CUSTOM\n')
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'))