mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-19 04:27:55 +01:00
update settings
This commit is contained in:
parent
b65541ff54
commit
8b9b1af612
@ -11,47 +11,48 @@ export default class {
|
||||
return this;
|
||||
}
|
||||
|
||||
startCode () {
|
||||
var gcode = this.config["startCode"];
|
||||
|
||||
gcode = this._subsituteVariables(gcode);
|
||||
|
||||
startCode () {
|
||||
const { startCode } = this.config;
|
||||
const gcode = this._subsituteVariables(startCode);
|
||||
return gcode;
|
||||
}
|
||||
|
||||
endCode () {
|
||||
var gcode = this.config["endCode"];
|
||||
|
||||
gcode = this._subsituteVariables(gcode);
|
||||
|
||||
endCode () {
|
||||
const { endCode } = this.config;
|
||||
const gcode = this._subsituteVariables(endCode);
|
||||
return gcode;
|
||||
}
|
||||
|
||||
_subsituteVariables (gcode) {
|
||||
var temperature = this.config["temperature"];
|
||||
var bedTemperature = this.config["bedTemperature"];
|
||||
var preheatTemperature = this.config["heatupTemperature"];
|
||||
var preheatBedTemperature = this.config["heatupBedTemperature"];
|
||||
var travelSpeed = this.config["travelSpeed"] * 60;
|
||||
var printerType = this.config["type"];
|
||||
var heatedbed = this.config["heatedbed"];
|
||||
let {
|
||||
temperature,
|
||||
bedTemperature,
|
||||
heatTemperature,
|
||||
heatBedTemperature,
|
||||
travelSpeed,
|
||||
printerType,
|
||||
heatedbed
|
||||
} = this.config;
|
||||
|
||||
travelSpeed *= 60;
|
||||
|
||||
switch (printerType) {
|
||||
case "makerbot_replicator2": printerType = "r2"; break;
|
||||
case "makerbot_replicator2x": printerType = "r2x"; break;
|
||||
case "makerbot_thingomatic": printerType = "t6"; break;
|
||||
case "makerbot_generic": printerType = "r2"; break;
|
||||
case "_3Dison_plus": printerType = "r2"; break;
|
||||
case 'makerbot_replicator2': printerType = 'r2'; break;
|
||||
case 'makerbot_replicator2x': printerType = 'r2x'; break;
|
||||
case 'makerbot_thingomatic': printerType = 't6'; break;
|
||||
case 'makerbot_generic': printerType = 'r2'; break;
|
||||
case '_3Dison_plus': printerType = 'r2'; break;
|
||||
}
|
||||
var heatedBedReplacement = heatedbed ? "" : ";";
|
||||
|
||||
gcode = gcode.replace(/{printingTemp}/gi, temperature);
|
||||
gcode = gcode.replace(/{printingBedTemp}/gi, bedTemperature);
|
||||
gcode = gcode.replace(/{preheatTemp}/gi, preheatTemperature);
|
||||
gcode = gcode.replace(/{preheatBedTemp}/gi, preheatBedTemperature);
|
||||
gcode = gcode.replace(/{printerType}/gi, printerType);
|
||||
gcode = gcode.replace(/{travelSpeed}/gi, travelSpeed);
|
||||
gcode = gcode.replace(/{if heatedBed}/gi, heatedBedReplacement);
|
||||
const heatedBedReplacement = heatedbed ? '' : ';';
|
||||
|
||||
gcode = gcode.replace(/{ printingTemp }/gi, temperature);
|
||||
gcode = gcode.replace(/{ printingBedTemp }/gi, bedTemperature);
|
||||
gcode = gcode.replace(/{ preheatTemp }/gi, heatTemperature);
|
||||
gcode = gcode.replace(/{ preheatBedTemp }/gi, heatBedTemperature);
|
||||
gcode = gcode.replace(/{ printerType }/gi, printerType);
|
||||
gcode = gcode.replace(/{ travelSpeed }/gi, travelSpeed);
|
||||
gcode = gcode.replace(/{ if heatedBed }/gi, heatedBedReplacement);
|
||||
|
||||
return gcode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user