Only multiply the feedrates with 60 in start/end code if they are preceded with and F

This commit is contained in:
daid 2012-07-06 15:24:58 +02:00
parent 750ed6de67
commit fb5cf680f6

View File

@ -386,32 +386,33 @@ def calculateSolidLayerCount():
## Alteration file functions
#########################################################
def replaceTagMatch(m):
tag = m.group(1)
pre = m.group(1)
tag = m.group(2)
if tag == 'time':
return time.strftime('%H:%M:%S')
return pre + time.strftime('%H:%M:%S')
if tag == 'date':
return time.strftime('%d %b %Y')
return pre + time.strftime('%d %b %Y')
if tag == 'day':
return time.strftime('%a')
return pre + time.strftime('%a')
if tag == 'print_time':
return '#P_TIME#'
return pre + '#P_TIME#'
if tag == 'filament_amount':
return '#F_AMNT#'
return pre + '#F_AMNT#'
if tag == 'filament_weight':
return '#F_WGHT#'
return pre + '#F_WGHT#'
if tag == 'filament_cost':
return '#F_COST#'
if tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']:
return pre + '#F_COST#'
if pre == 'F' and tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']:
f = getProfileSettingFloat(tag) * 60
elif isProfileSetting(tag):
f = getProfileSettingFloat(tag)
elif isPreference(tag):
f = getProfileSettingFloat(tag)
else:
return '?%s?' % (tag)
return '%s?%s?' % (pre, tag)
if (f % 1) == 0:
return str(int(f))
return str(f)
return pre + str(int(f))
return pre + str(f)
def replaceGCodeTags(filename, gcodeInt):
f = open(filename, 'r+')
@ -476,5 +477,5 @@ def getAlterationFileContents(filename):
#Always remove the extruder on/off M codes. These are no longer needed in 5D printing.
prefix = 'M101\nM103\n'
return unicode(prefix + re.sub("\{([^\}]*)\}", replaceTagMatch, alterationContents).rstrip() + '\n' + postfix).encode('utf-8')
return unicode(prefix + re.sub("(.)\{([^\}]*)\}", replaceTagMatch, alterationContents).rstrip() + '\n' + postfix).encode('utf-8')