fix first position, indexed first position
This commit is contained in:
parent
3452297dc6
commit
495c32bcbd
4 changed files with 14 additions and 12 deletions
|
|
@ -81,7 +81,7 @@ class Point {
|
|||
|
||||
clone() {
|
||||
let p = newPoint(this.x, this.y, this.z, this._key);
|
||||
if (this.a) {
|
||||
if (this.a !== undefined) {
|
||||
p.a = this.a;
|
||||
}
|
||||
return p;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ CAM.export = function(print, online) {
|
|||
maxZd = spro.camFastFeedZ,
|
||||
maxXYd = spro.camFastFeed,
|
||||
decimals = base.config.gcode_decimals || 4,
|
||||
pos = { x:null, y:null, z:null, a:null, f:null, t:null, emit:null },
|
||||
pos = { x:null, y:null, z:null, a:undefined, f:null, t:null, emit:null },
|
||||
line,
|
||||
cidx,
|
||||
mode,
|
||||
|
|
@ -170,7 +170,7 @@ CAM.export = function(print, online) {
|
|||
newpos.x = util.round(newpos.x, decimals);
|
||||
newpos.y = util.round(newpos.y, decimals);
|
||||
newpos.z = util.round(newpos.z, decimals);
|
||||
newpos.a = util.round(newpos.a || 0, decimals);
|
||||
// newpos.a = util.round(newpos.a || 0, decimals);
|
||||
|
||||
// on tool change
|
||||
let changeTool = out.tool != pos.t;
|
||||
|
|
@ -199,21 +199,21 @@ CAM.export = function(print, online) {
|
|||
// split first move to X,Y then Z for that new location
|
||||
// safety to prevent tool crashing
|
||||
if (points === 0) {
|
||||
pos.x = pos.y = pos.z = pos.a = 0;
|
||||
pos.x = pos.y = pos.z = 0;
|
||||
points++;
|
||||
moveTo({
|
||||
// speed: Infinity,
|
||||
tool: out.tool,
|
||||
point: { x: newpos.x, y: newpos.y, z: pos.z, a: pos.a }
|
||||
}, {
|
||||
dx: 1, dy: 1, dz: 0, da: 0, time: 0
|
||||
dx: 1, dy: 1, dz: 0, time: 0
|
||||
});
|
||||
moveTo({
|
||||
// speed: Infinity,
|
||||
tool: out.tool,
|
||||
point: { x: newpos.x, y: newpos.y, z: newpos.z, a: newpos.a }
|
||||
}, {
|
||||
dx: 0, dy: 0, dz: 1, da: 0, time: 0
|
||||
dx: 0, dy: 0, dz: 1, time: 0
|
||||
});
|
||||
points--;
|
||||
return;
|
||||
|
|
@ -224,7 +224,6 @@ CAM.export = function(print, online) {
|
|||
dx = opt.dx || newpos.x - pos.x,
|
||||
dy = opt.dy || newpos.y - pos.y,
|
||||
dz = opt.dz || newpos.z - pos.z,
|
||||
da = opt.da || newpos.a - pos.a,
|
||||
maxf = dz ? maxZd : maxXYd,
|
||||
feed = Math.min(speed || maxf, maxf),
|
||||
dist = Math.sqrt(dx * dx + dy * dy + dz * dz),
|
||||
|
|
@ -253,7 +252,7 @@ CAM.export = function(print, online) {
|
|||
runbox.max.z = Math.max(runbox.max.z, pos.z);
|
||||
nl.append(space).append("Z").append(add0(pos.z * factor));
|
||||
}
|
||||
if (da || newpos.a !== pos.a) {
|
||||
if (newpos.a !== pos.a) {
|
||||
pos.a = newpos.a;
|
||||
nl.append(space).append("A").append(add0(pos.a * factor));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,12 @@ class OpIndex extends CamOp {
|
|||
prepare(ops, progress) {
|
||||
const { lastPoint, zmax, camOut, stock } = ops;
|
||||
// max point of stock corner radius when rotating (safe z when indexing)
|
||||
const rzmax = (Math.max(stock.y, stock.z) * Math.sqrt(2)) / 2;
|
||||
camOut(lastPoint().clone().setZ(rzmax), 0);
|
||||
const last = lastPoint();
|
||||
if (last) {
|
||||
const rzmax = (Math.max(stock.y, stock.z) * Math.sqrt(2)) / 2;
|
||||
const zmove = Math.max(rzmax, zmax);
|
||||
camOut(last.clone().setZ(zmove), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
let mark = Date.now();
|
||||
let slicer = new kiri.cam_slicer(widget.getPoints(), {
|
||||
zlist: true,
|
||||
zline: true,
|
||||
nobucket: isIndexed
|
||||
zline: true
|
||||
});
|
||||
|
||||
function updateToolDiams(toolDiam) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue