""",\r
#######################################################################################\r
'end.gcode': """;End GCode\r
-M104 S0 ;extruder heater off\r
-M140 S0 ;heated bed heater off (if you have it)\r
+M104 S0 ;extruder heater off\r
+M140 S0 ;heated bed heater off (if you have it)\r
\r
-G91 ;relative positioning\r
-G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\r
-G1 Z+0.5 E-5 F{max_z_speed};move Z up a bit and retract filament even more\r
-G1 Z+3 F{max_z_speed} ;move Z up a bit more without retraction\r
-G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\r
+G91 ;relative positioning\r
+G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\r
+G1 Z+0.5 E-5 F{max_z_speed} ;move Z up a bit and retract filament even more\r
+G1 Z+3 F{max_z_speed} ;move Z up a bit more without retraction\r
+G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\r
\r
-M84 ;steppers off\r
-G90 ;absolute positioning\r
+M84 ;steppers off\r
+G90 ;absolute positioning\r
""",\r
#######################################################################################\r
'support_start.gcode': '',\r
## Alteration file functions\r
#########################################################\r
def replaceTagMatch(m):\r
- tag = m.group(1)\r
+ pre = m.group(1)\r
+ tag = m.group(2)\r
if tag == 'time':\r
- return time.strftime('%H:%M:%S')\r
+ return pre + time.strftime('%H:%M:%S')\r
if tag == 'date':\r
- return time.strftime('%d %b %Y')\r
+ return pre + time.strftime('%d %b %Y')\r
if tag == 'day':\r
- return time.strftime('%a')\r
+ return pre + time.strftime('%a')\r
if tag == 'print_time':\r
- return '#P_TIME#'\r
+ return pre + '#P_TIME#'\r
if tag == 'filament_amount':\r
- return '#F_AMNT#'\r
+ return pre + '#F_AMNT#'\r
if tag == 'filament_weight':\r
- return '#F_WGHT#'\r
+ return pre + '#F_WGHT#'\r
if tag == 'filament_cost':\r
- return '#F_COST#'\r
- if tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']:\r
+ return pre + '#F_COST#'\r
+ if pre == 'F' and tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']:\r
f = getProfileSettingFloat(tag) * 60\r
elif isProfileSetting(tag):\r
f = getProfileSettingFloat(tag)\r
elif isPreference(tag):\r
f = getProfileSettingFloat(tag)\r
else:\r
- return '?%s?' % (tag)\r
+ return '%s?%s?' % (pre, tag)\r
if (f % 1) == 0:\r
- return str(int(f))\r
- return str(f)\r
+ return pre + str(int(f))\r
+ return pre + str(f)\r
\r
def replaceGCodeTags(filename, gcodeInt):\r
f = open(filename, 'r+')\r
#Always remove the extruder on/off M codes. These are no longer needed in 5D printing.\r
prefix = 'M101\nM103\n'\r
\r
- return unicode(prefix + re.sub("\{([^\}]*)\}", replaceTagMatch, alterationContents).rstrip() + '\n' + postfix).encode('utf-8')\r
+ return unicode(prefix + re.sub("(.)\{([^\}]*)\}", replaceTagMatch, alterationContents).rstrip() + '\n' + postfix).encode('utf-8')\r
\r