diff --git a/src/gcode.js b/src/gcode.js index efba660..506f05e 100644 --- a/src/gcode.js +++ b/src/gcode.js @@ -10,7 +10,7 @@ const POSITION_Y = 'Y'; const POSITION_Z = 'Z'; export default class { - constructor () { + constructor (settings) { this.gcode = ''; this.current = {}; @@ -19,6 +19,10 @@ export default class { this.isRetracted = false; this.isFanOn = false; this._nozzlePosition = new THREE.Vector2(0, 0); + + if (settings !== undefined) { + this.setSettings(settings); + } } _addGCode (command) { diff --git a/src/sliceActions/slicesToGCode.js b/src/sliceActions/slicesToGCode.js index 7ab7df9..cfa6f5e 100644 --- a/src/sliceActions/slicesToGCode.js +++ b/src/sliceActions/slicesToGCode.js @@ -3,7 +3,7 @@ import GCode from '../gcode.js'; export default function slicesToGCode(slices, settings) { console.log('slices to gcode'); - const gcode = new GCode().setSettings(settings); + const gcode = new GCode(settings); for (let layer = 0; layer < slices.length; layer ++) { const slice = slices[layer];