extend zTop limit support to rough and outline
This commit is contained in:
parent
a48b0f1d80
commit
b8cdc9f144
4 changed files with 30 additions and 18 deletions
|
|
@ -173,7 +173,7 @@ class OpRough extends CamOp {
|
|||
let { op, state } = this;
|
||||
let { settings, slicer, addSlices, unsafe, color } = state;
|
||||
let { updateToolDiams, thruHoles, tabs, cutTabs, cutPolys } = state;
|
||||
let { ztOff, zBottom, zThru, zMax, shadowAt, isIndexed} = state;
|
||||
let { ztOff, zBottom, zMax, shadowAt, isIndexed} = state;
|
||||
let { workarea } = state;
|
||||
let { process, stock } = settings;
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ class OpRough extends CamOp {
|
|||
updateToolDiams(toolDiam);
|
||||
|
||||
// clear the stock above the area to be roughed out
|
||||
{
|
||||
if (workarea.top_z > workarea.top_part) {
|
||||
let shadow = state.shadow.base.clone();
|
||||
let step = toolDiam * op.step;
|
||||
let inset = roughStock ?
|
||||
|
|
@ -283,6 +283,9 @@ class OpRough extends CamOp {
|
|||
// exclude flats injected to complete shadow
|
||||
return;
|
||||
}
|
||||
if (data.z > workarea.top_z) {
|
||||
return;
|
||||
}
|
||||
data.shadow = trueShadow ? shadowAt(data.z) : shadow.clone(true);
|
||||
data.slice.shadow = data.shadow;
|
||||
slices.push(data.slice);
|
||||
|
|
@ -405,7 +408,9 @@ class OpRough extends CamOp {
|
|||
});
|
||||
|
||||
let last = slices[slices.length-1];
|
||||
for (let zneg of base.util.lerp(0, zThru, op.down)) {
|
||||
|
||||
if (workarea.bottom_z < 0)
|
||||
for (let zneg of base.util.lerp(0, -workarea.bottom_cut, op.down)) {
|
||||
if (!last) continue;
|
||||
let add = last.clone(true);
|
||||
add.z -= zneg;
|
||||
|
|
@ -482,8 +487,8 @@ class OpOutline extends CamOp {
|
|||
async slice(progress) {
|
||||
let { op, state } = this;
|
||||
let { settings, widget, slicer, addSlices, tshadow, thruHoles, unsafe, color } = state;
|
||||
let { updateToolDiams, zThru, zBottom, tabs, cutTabs, cutPolys } = state;
|
||||
let { zMax, ztOff } = state;
|
||||
let { updateToolDiams, tabs, cutTabs, cutPolys, workarea } = state;
|
||||
let { zMax } = state;
|
||||
let { process, stock } = settings;
|
||||
|
||||
if (op.down <= 0) {
|
||||
|
|
@ -495,8 +500,11 @@ class OpOutline extends CamOp {
|
|||
let shadow = [];
|
||||
let slices = [];
|
||||
let intopt = {
|
||||
down: true, min: zBottom, fit: true, off: 0.01,
|
||||
max: op.top ? zMax + ztOff : undefined
|
||||
off: 0.01,
|
||||
fit: true,
|
||||
down: true,
|
||||
min: Math.max(0, workarea.bottom_z),
|
||||
max: workarea.top_z
|
||||
};
|
||||
let indices = slicer.interval(op.down, intopt);
|
||||
let trueShadow = process.camTrueShadow === true;
|
||||
|
|
@ -507,12 +515,11 @@ class OpOutline extends CamOp {
|
|||
.map(v => (parseFloat(v) - 0.01).round(5))
|
||||
.filter(v => v > 0 && indices.indexOf(v) < 0);
|
||||
indices = indices.appendAll(flats).sort((a,b) => b-a);
|
||||
indices = indices.filter(v => v - zBottom >= -0.001);
|
||||
// console.log('indices', ...indices, {zBottom, slicer});
|
||||
|
||||
let cnt = 0;
|
||||
let tot = 0;
|
||||
if (op.outside && !op.inside) {
|
||||
// console.log({outline_bypass: indices, down: op.down});
|
||||
console.log({outline_bypass: indices, down: op.down});
|
||||
indices.forEach((ind,i) => {
|
||||
if (flats.indexOf(ind) >= 0) {
|
||||
// exclude flats
|
||||
|
|
@ -560,9 +567,9 @@ class OpOutline extends CamOp {
|
|||
}
|
||||
|
||||
// extend cut thru (only when z bottom is 0)
|
||||
if (zThru) {
|
||||
if (workarea.bottom_z < 0) {
|
||||
let last = slices[slices.length-1];
|
||||
for (let zneg of base.util.lerp(0, zThru, op.down)) {
|
||||
for (let zneg of base.util.lerp(0, -workarea.bottom_cut, op.down)) {
|
||||
if (!last) continue;
|
||||
let add = last.clone(true);
|
||||
add.tops.forEach(top => top.poly.setZ(add.z));
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
|
|||
// greater of widget bottom and z bottom
|
||||
zMin = isIndexed ? bounds.min.z : Math.max(bounds.min.z, zBottom),
|
||||
zMax = bounds.max.z,
|
||||
zThru = camZBottom ? 0 : (camZThru || 0),
|
||||
zThru = camZThru,
|
||||
zTop = zMax + ztOff,
|
||||
minToolDiam = Infinity,
|
||||
maxToolDiam = -Infinity,
|
||||
|
|
@ -66,7 +66,11 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
|
|||
bottom_part = 0,
|
||||
bottom_stock = -bottom_gap,
|
||||
bottom_thru = zThru,
|
||||
bottom_z = (camZBottom ? bottom_stock + proc.camZBottom : bottom_part) - bottom_thru,
|
||||
bottom_z = Math.max(
|
||||
(camZBottom ? bottom_stock + proc.camZBottom : bottom_part) - bottom_thru,
|
||||
(camZBottom ? bottom_stock + camZBottom : bottom_stock - bottom_thru)
|
||||
),
|
||||
bottom_cut = Math.max(bottom_z, -zThru),
|
||||
top_stock = zTop,
|
||||
top_part = zMax,
|
||||
top_gap = ztOff,
|
||||
|
|
@ -77,7 +81,8 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
|
|||
top_z,
|
||||
bottom_stock,
|
||||
bottom_part,
|
||||
bottom_z
|
||||
bottom_z,
|
||||
bottom_cut
|
||||
}, 3);
|
||||
|
||||
console.table({ workarea });
|
||||
|
|
|
|||
|
|
@ -1209,8 +1209,8 @@ gapp.register("kiri.init", (root, exports) => {
|
|||
camZOffset: newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:toFloat, units:true}),
|
||||
camZTop: newInput(LANG.ou_ztop_s, {title:LANG.ou_ztop_l, convert:toFloat, units:true, trigger: true}),
|
||||
camZBottom: newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:toFloat, units:true, trigger: true}),
|
||||
camZThru: newInput(LANG.ou_ztru_s, {title:LANG.ou_ztru_l, convert:toFloat, bound:bound(0.0,100), units:true, show:() => { return ui.camZBottom.value == 0 }}),
|
||||
camZClearance: newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:toFloat, bound:bound(0.01,100), units:true}),
|
||||
camZThru: newInput(LANG.ou_ztru_s, {title:LANG.ou_ztru_l, convert:toFloat, bound:bound(0.0,100), units:true }),
|
||||
camZClearance: newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:toFloat, bound:bound(0.01,100), units:true }),
|
||||
camFastFeedZ: newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:toFloat, units:true}),
|
||||
camFastFeed: newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:toFloat, units:true}),
|
||||
_____: newGroup(LANG.ou_menu, $('cam-output'), { modes:CAM, driven, separator, group:"cam-output" }),
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ self.kiri.lang['en-us'] = {
|
|||
ou_ztof_s: "z offset",
|
||||
ou_ztof_l: ["offset z anchor","in workspace units"],
|
||||
ou_ztop_s: "z top",
|
||||
ou_ztop_l: ["offset from stock bottom","to set start of cutting depth","in workspace units","* Pocket & Trace ONLY *"],
|
||||
ou_ztop_l: ["offset from stock bottom","to set start of cutting depth","in workspace units","* drill/contour ignore this *"],
|
||||
ou_zbot_s: "z bottom",
|
||||
ou_zbot_l: ["offset from stock bottom","to limit cutting depth","in workspace units"],
|
||||
ou_zclr_s: "z clearance",
|
||||
|
|
|
|||
Loading…
Reference in a new issue