From: Daid Date: Wed, 9 May 2012 18:16:32 +0000 (+0200) Subject: If gcode tags have integer values then export them as integer, else export them as... X-Git-Tag: RC3~11^2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9fe9117226ab02c13e9976d05ee5d26083cea638;p=cura.git If gcode tags have integer values then export them as integer, else export them as float --- diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 22d30fb0..2be195e7 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -359,12 +359,16 @@ def calculateSolidLayerCount(): def replaceTagMatch(m): tag = m.group(0)[1:-1] if tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']: - return str(getProfileSettingFloat(tag) * 60) - if isProfileSetting(tag): - return str(getProfileSettingFloat(tag)) - if isPreference(tag): - return str(getProfileSettingFloat(tag)) - return tag + f = getProfileSettingFloat(tag) * 60 + elif isProfileSetting(tag): + f = getProfileSettingFloat(tag) + elif isPreference(tag): + f = getProfileSettingFloat(tag) + else: + return tag + if (f % 1) == 0: + return str(int(f)) + return str(f) ### Get aleration raw contents. (Used internally in Cura) def getAlterationFile(filename):