-M104 S0 ;extruder heat off
-G91 ;relative positioning
-G1 Z+10 E-5 F400 ;move Z up a bit and retract filament by 5mm
-G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
-M84 ;steppers off
-G90 ;absolute positioning
-
+M104 S0 ;extruder heat off
+G91 ;relative positioning
+G1 Z+10 E-5 F{max_z_speed} ;move Z up a bit and retract filament by 5mm
+G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
+M84 ;steppers off
+G90 ;absolute positioning
; to Z1.0 - the number after the Z is the actual, physical
; height of the nozzle in mm. This can take some messing around
; with to get just right...
-G92 X0 Y0 Z0 E0 ;reset software position to front/left/z=0.0
-G1 Z15.0 F400 ;move the platform down 15mm
-G92 E0 ;zero the extruded length
+G92 X0 Y0 Z0 E0 ;reset software position to front/left/z=0.0
+G1 Z15.0 F{max_z_speed} ;move the platform down 15mm
+G92 E0 ;zero the extruded length
-G1 F75 E5 ;extrude 5mm of feed stock
-G1 F75 E3.5 ;reverse feed stock by 1.5mm
-G92 E0 ;zero the extruded length again
+G1 F200 E5 ;extrude 5mm of feed stock
+G1 F200 E3.5 ;reverse feed stock by 1.5mm
+G92 E0 ;zero the extruded length again
-G1 X100 Y100 F3500 ;go to the middle of the platform
-G1 Z0.0 F400 ;back to Z=0 and start the print!
+;go to the middle of the platform, and move to Z=0 before starting the print.
+G1 X{machine_center_x} Y{machine_center_y} F{travel_speed}
+G1 Z0.0 F{max_z_speed}
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.\r
import __init__\r
\r
-import ConfigParser\r
-import os\r
-import traceback\r
-import math\r
+import ConfigParser, os, traceback, math, re\r
\r
#########################################################\r
## Profile and preferences functions\r
'bridge_material_amount': '100',\r
'raft_margin': '5',\r
'raft_base_material_amount': '100',\r
- 'raft_interface_material_amount': '100',
+ 'raft_interface_material_amount': '100',\r
'bottom_thickness': '0.3',\r
'add_start_end_gcode': 'True',\r
- 'gcode_extension': 'gcode',
+ 'gcode_extension': 'gcode',\r
}\r
preferencesDefaultSettings = {\r
'wizardDone': 'False',\r
def getAlterationFilePath(filename):\r
return os.path.join(getCuraBasePath(), "alterations", filename)\r
\r
-def getAlterationFileContents(filename, allowMagicPrefix = True):\r
+def replaceTagMatch(m):\r
+ tag = m.group(0)[1:-1]\r
+ if tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']:\r
+ return str(getProfileSettingFloat(tag) * 60)\r
+ return str(getProfileSettingFloat(tag))\r
+\r
+def getAlterationFileContents(filename, modifyForOutput = True):\r
"Get the file from the fileName or the lowercase fileName in the alterations directories."\r
prefix = ''\r
- if allowMagicPrefix:\r
+ if modifyForOutput:\r
if filename == 'start.gcode':\r
#For the start code, hack the temperature and the steps per E value into it. So the temperature is reached before the start code extrusion.\r
#We also set our steps per E here, if configured.\r
file = open(fullFilename, "r")\r
fileText = file.read()\r
file.close()\r
+ if modifyForOutput:\r
+ fileText = re.sub("\{[^\}]*\}", replaceTagMatch, fileText)\r
return prefix + fileText\r
return prefix\r
\r