From: hg42@gmx.net Date: Sat, 18 Jan 2014 18:55:43 +0000 (+0100) Subject: fix issue #704, replacing variables in gcode file damaging line at file offset 2048 X-Git-Tag: 14.02-RC1~54^2^2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=163d0407973092318e422e2b3905d646fc580bf3;p=cura.git fix issue #704, replacing variables in gcode file damaging line at file offset 2048 --- diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 41469975..05b280fe 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -963,8 +963,8 @@ def replaceGCodeTags(filename, gcodeInt): def replaceGCodeTagsFromSlicer(filename, slicerInt): f = open(filename, 'r+') data = f.read(2048) - data = data.replace('#P_TIME#', slicerInt.getPrintTime()) - data = data.replace('#F_AMNT#', slicerInt.getFilamentAmount()) + data = data.replace('#P_TIME#', ('%8.2f' % (int(slicerInt._printTimeSeconds)))[-8:]) + data = data.replace('#F_AMNT#', ('%8.2f' % (slicerInt._filamentMM[0]))[-8:]) data = data.replace('#F_WGHT#', ('%8.2f' % (float(slicerInt.getFilamentWeight()) * 1000))[-8:]) cost = slicerInt.getFilamentCost() if cost is None: