mirror of
https://github.com/teachingtechYT/teachingtechYT.github.io.git
synced 2024-08-30 18:23:26 +00:00
Fix wonky generation on retraction prints
Was subtracting only integer part of gcode, which inverts the fractional part and produces jagged lines whenever X or Y becomes negative.
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user