fixes #193 and adds additional offset parameters
This commit is contained in:
parent
9dbec25714
commit
d55b7ba9e8
5 changed files with 41 additions and 42 deletions
|
|
@ -6,9 +6,9 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
|
|||
# Release 3.6
|
||||
|
||||
* improve CAM animation speeds
|
||||
* add CAM op level part offset parameters for xy and z
|
||||
* fix belt fan override for base extrusions touching belt
|
||||
|
||||
|
||||
# Release 3.5 (2022-10-07)
|
||||
|
||||
## Kiri:moto
|
||||
|
|
|
|||
|
|
@ -981,7 +981,8 @@ CAM.init = function(kiri, api) {
|
|||
spindle: 'camLevelSpindle',
|
||||
step: 'camLevelOver',
|
||||
rate: 'camLevelSpeed',
|
||||
down: 'camLevelDown'
|
||||
down: 'camLevelDown',
|
||||
over: 'camLevelOver'
|
||||
}).inputs = {
|
||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
|
|
@ -989,6 +990,7 @@ CAM.init = function(kiri, api) {
|
|||
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0)}),
|
||||
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
|
||||
down: UC.newInput(LANG.cc_loff_s, {title:LANG.cc_loff_l, convert:UC.toFloat, units:true}),
|
||||
over: UC.newInput(LANG.cc_lxyo_s, {title:LANG.cc_lxyo_l, convert:UC.toFloat, units:true}),
|
||||
};
|
||||
|
||||
createPopOp('rough', {
|
||||
|
|
|
|||
|
|
@ -59,57 +59,50 @@ class OpLevel extends CamOp {
|
|||
let { op, state } = this;
|
||||
let { settings, widget, sliceAll } = state;
|
||||
let { updateToolDiams, thruHoles, tabs, cutTabs } = state;
|
||||
let { bounds, zMax, ztOff, color } = state;
|
||||
let { bounds, zMax, ztOff, color, tshadow } = state;
|
||||
let { stock } = settings;
|
||||
|
||||
let toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
|
||||
let stepOver = toolDiam * op.step;
|
||||
let stepOver = this.stepOver = toolDiam * op.step;
|
||||
let z = zMax + ztOff - op.down;
|
||||
|
||||
updateToolDiams(toolDiam);
|
||||
|
||||
let path = newPolygon().setOpen(),
|
||||
center = {x:0, y:0, z:0},
|
||||
x1 = bounds.min.x,
|
||||
y1 = bounds.min.y,
|
||||
x2 = bounds.max.x,
|
||||
y2 = bounds.max.y,
|
||||
z = bounds.max.z - (op.down || 0);
|
||||
let points = [];
|
||||
let clear = POLY.offset(tshadow, toolDiam * (op.over || 0));
|
||||
// let tabsub = [];
|
||||
// POLY.subtract(clear, POLY.offset(tabs.map(t => t.poly), toolDiam/2), tabsub, []);
|
||||
POLY.fillArea(clear, 90, stepOver, points);
|
||||
|
||||
if (stock.x && stock.y && stock.z) {
|
||||
x1 = -stock.x / 2;
|
||||
y1 = -stock.y / 2;
|
||||
x2 = -x1;
|
||||
y2 = -y1;
|
||||
z = zMax + ztOff - (op.down || 0);
|
||||
let lines = this.lines = [];
|
||||
for (let i=0; i<points.length; i += 2) {
|
||||
let slice = newSlice(z);
|
||||
lines.push( newPolygon().setOpen().addPoints([ points[i], points[i+1] ]).setZ(z) );
|
||||
slice.output()
|
||||
.setLayer("level", {face: color, line: color})
|
||||
.addPolys(this.lines);
|
||||
sliceAll.push(slice);
|
||||
}
|
||||
|
||||
let ei = 0,
|
||||
xd = x2 - x1,
|
||||
xi = xd / Math.floor(xd / stepOver);
|
||||
|
||||
for (let x = x1, lx = x, ei = 0; x <= x2; x += xi, ei++, lx = x) {
|
||||
if (ei % 2 === 0) {
|
||||
path.add(x,y1,z).add(x,y2,z);
|
||||
} else {
|
||||
path.add(x,y2,z).add(x,y1,z);
|
||||
}
|
||||
}
|
||||
|
||||
let slice = newSlice(z);
|
||||
this.lines = slice.camLines = [ path ];
|
||||
slice.output()
|
||||
.setLayer("level", {face: color, line: color})
|
||||
.addPolys(this.lines);
|
||||
sliceAll.push(slice);
|
||||
}
|
||||
|
||||
prepare(ops, progress) {
|
||||
let { op, state, lines } = this;
|
||||
let { setTool, setSpindle } = ops;
|
||||
let { polyEmit, newLayer } = ops;
|
||||
let { op, state, lines, stepOver } = this;
|
||||
let { setTool, setSpindle, printPoint } = ops;
|
||||
let { polyEmit, newLayer, tip2tipEmit, camOut } = ops;
|
||||
|
||||
setTool(op.tool, op.rate);
|
||||
setSpindle(op.spindle);
|
||||
polyEmit(lines[0]);
|
||||
lines = lines.map(p => { return { first: p.first(), last: p.last(), poly: p } });
|
||||
tip2tipEmit(lines, printPoint, (el, point, count) => {
|
||||
let poly = el.poly;
|
||||
if (poly.last() === point) {
|
||||
poly.reverse();
|
||||
}
|
||||
poly.forEachPoint((point, pidx) => {
|
||||
camOut(point.clone(), pidx > 0, stepOver);
|
||||
}, false);
|
||||
});
|
||||
|
||||
newLayer();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -458,6 +458,7 @@ const conf = exports({
|
|||
camLevelOver: 0.75,
|
||||
camLevelSpeed: 1000,
|
||||
camLevelDown: 0,
|
||||
camLevelOver: 0.5,
|
||||
camRoughTool: 1000,
|
||||
camRoughSpindle: 1000,
|
||||
camRoughDown: 2,
|
||||
|
|
|
|||
|
|
@ -454,8 +454,11 @@ self.kiri.lang['en-us'] = {
|
|||
cc_rzpd_s: "z feed",
|
||||
cc_rzpd_l: ["max z moves feedrate","in workspace units / minute"],
|
||||
|
||||
cc_loff_s: "offset",
|
||||
cc_loff_l: ["distance from stock face","for leveling pass","in workspace units"],
|
||||
// CNC LEVELING
|
||||
cc_loff_s: "z offset",
|
||||
cc_loff_l: ["distance from stock face","in workspace units"],
|
||||
cc_lxyo_s: "xy offset",
|
||||
cc_lxyo_l: ["xy offset from part boundary as a fraction of the tool diameter (0 - 1.0)"],
|
||||
|
||||
// CNC ROUGHING
|
||||
cr_menu: "rough",
|
||||
|
|
|
|||
Loading…
Reference in a new issue