fixes to allow cam processing with engine.html

This commit is contained in:
Stewart Allen 2021-09-27 11:28:07 -04:00
commit 7ea9f2a7ef
4 changed files with 30 additions and 4 deletions

View file

@ -82,6 +82,21 @@ class Engine {
return this;
}
setTools(tools) {
this.settings.tools = tools;
return this;
}
setStock(stock) {
this.settings.stock = stock;
return this;
}
setOrigin(x,y,z) {
this.settings.origin = { x, y, z };
return this;
}
moveTo(x, y, z) {
this.widget.move(x, y, z, true);
return this;

View file

@ -761,6 +761,16 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
return this.bounds;
};
PRO.getPositionBox = function() {
let bounds = this.getBoundingBox().clone();
let pos = this.track.pos;
bounds.min.x += pos.x;
bounds.max.x += pos.x;
bounds.min.y += pos.y;
bounds.max.y += pos.y;
return bounds;
};
PRO.isModified = function() {
return this.modified;
};

View file

@ -29,6 +29,7 @@
settings = print.settings,
device = settings.device,
gcodes = settings.device || {},
origin = settings.origin || { x: 0, y: 0, z: 0 },
tools = settings.tools,
space = gcodes.gcodeSpace ? ' ' : '',
isRML = device.gcodeFExt.toLowerCase() === 'rml',
@ -57,8 +58,8 @@
min: { x:Infinity, y:Infinity, z:Infinity}
},
offset = {
x: -settings.origin.x,
y: settings.origin.y
x: -origin.x,
y: origin.y
},
consts = {
tool: 0,

View file

@ -54,8 +54,8 @@
let device = settings.device,
process = settings.process,
stock = settings.stock,
outer = settings.bounds,
stock = settings.stock || {},
outer = settings.bounds || widget.getPositionBox(),
outerz = outer.max.z,
slices = widget.slices,
hasStock = stock.x && stock.y && stock.z && process.camStockOn,