add control of tab depth (projection from surface)

This commit is contained in:
Stewart Allen 2020-11-28 08:21:25 -05:00
commit 30c7b841ce
5 changed files with 12 additions and 8 deletions

View file

@ -440,6 +440,7 @@
camDrillReg: "none",
camTabsWidth: 5,
camTabsHeight: 5,
camTabsDepth: 5,
camTabsOn: false,
camDepthFirst: false,
camEaseDown: false,

View file

@ -1543,6 +1543,7 @@
camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:false}),
camTabsWidth: UC.newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}),
camTabsHeight: UC.newInput(LANG.ct_hght_s, {title:LANG.ct_hght_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}),
camTabsDepth: UC.newInput(LANG.ct_dpth_s, {title:LANG.ct_dpth_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}),
camTabSep: UC.newBlank({class:"pop-sep"}),
camTabsManual: UC.newRow([
(UI.tabAdd = UC.newButton(undefined, onButtonClick, {icon:'<i class="fas fa-plus"></i>'})),

View file

@ -362,11 +362,11 @@ KIRI.worker = {
let p3 = (x * height);
let p4 = (x - 1) * height;
faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p2;
faces[ii++] = p3;
faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p4;
faces[ii++] = p3;
}
}
// create bottom vertices & faces
@ -407,11 +407,11 @@ KIRI.worker = {
let p3 = 0 + (y - 1);
let p4 = 0 + (y - 0);
faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p2;
faces[ii++] = p3;
faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p4;
faces[ii++] = p3;
}
}
// create right vertices & faces

View file

@ -241,15 +241,15 @@
function createTabBox(iw, ic, n) {
const { track } = iw;
const { stock, bounds, process } = API.conf.get();
const { camTabsWidth, camTabsHeight } = process;
const { camTabsWidth, camTabsHeight, camTabsDepth } = process;
const sz = stock.z || bounds.max.z;
const zp = sz - track.box.d + process.camZBottom - process.camZTopOffset + camTabsHeight / 2;
ic.x += n.x * 2.5; // offset from part
ic.z -= n.y * 2.5; // offset swap z,y
ic.x += n.x * camTabsDepth / 2; // offset from part
ic.z -= n.y * camTabsDepth / 2; // offset swap z,y
ic.y = zp; // offset swap in world space y,z
const rot = new THREE.Quaternion().setFromAxisAngle(zaxis, Math.atan2(n.y, n.x));
const pos = { x:ic.x, y:ic.y, z:ic.z };
const dim = { x:5, y:camTabsWidth, z:camTabsHeight };
const dim = { x:camTabsDepth, y:camTabsWidth, z:camTabsHeight };
const tab = addbox(pos, 0x0000dd, 'tabb', dim, { rotate: rot });
return { pos, dim, rot, tab, width: camTabsWidth, height: camTabsHeight };
}