chiark / gitweb /
Updated project planner to use an alteration file between each print.
authordaid <daid303@gmail.com>
Thu, 19 Apr 2012 14:31:39 +0000 (16:31 +0200)
committerdaid <daid303@gmail.com>
Thu, 19 Apr 2012 14:31:39 +0000 (16:31 +0200)
Cura/alterations/nextobject.gcode [new file with mode: 0644]
Cura/gui/projectPlanner.py

diff --git a/Cura/alterations/nextobject.gcode b/Cura/alterations/nextobject.gcode
new file mode 100644 (file)
index 0000000..e32a40d
--- /dev/null
@@ -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}
+
index c6c5f05c519f4cc3449d16a8f51ab4aab5208948..0822a44aa068135adb57d481b58cca5d7f40acd9 100644 (file)
@@ -217,23 +217,34 @@ class projectPlanner(wx.Frame):
                #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
@@ -245,7 +256,6 @@ class projectPlanner(wx.Frame):
                        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