diff --git a/js/gcodeprocessing.js b/js/gcodeprocessing.js index 35a8669..15d550d 100644 --- a/js/gcodeprocessing.js +++ b/js/gcodeprocessing.js @@ -234,17 +234,17 @@ function processRetraction(){ if(centre == true){ var retractionArray = retraction.split(/\n/g); - var regexp = /X\d+/; + var regexp = /X[0-9\.]+/; retractionArray.forEach(function(index, item){ if(retractionArray[item].search(/X/) > -1){ - var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) - 50; + var value = parseFloat(retractionArray[item].match(regexp)[0].substring(1)) - 50; retractionArray[item] = retractionArray[item].replace(regexp, "X"+String(value)); } }); - var regexp = /Y\d+/; + var regexp = /Y[0-9\.]+/; retractionArray.forEach(function(index, item){ if(retractionArray[item].search(/Y/) > -1){ - var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) - 50; + var value = parseFloat(retractionArray[item].match(regexp)[0].substring(1)) - 50; retractionArray[item] = retractionArray[item].replace(regexp, "Y"+String(value)) } }); @@ -537,4 +537,4 @@ function processAcceleration(){ acceleration = acceleration.replace(/j6/g, "M205 J"+f4); } downloadFile('acceleration.gcode', acceleration); -} \ No newline at end of file +}