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", camDrillReg: "none",
camTabsWidth: 5, camTabsWidth: 5,
camTabsHeight: 5, camTabsHeight: 5,
camTabsDepth: 5,
camTabsOn: false, camTabsOn: false,
camDepthFirst: false, camDepthFirst: false,
camEaseDown: false, camEaseDown: false,

View file

@ -1543,6 +1543,7 @@
camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:false}), 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}), 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}), 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"}), camTabSep: UC.newBlank({class:"pop-sep"}),
camTabsManual: UC.newRow([ camTabsManual: UC.newRow([
(UI.tabAdd = UC.newButton(undefined, onButtonClick, {icon:'<i class="fas fa-plus"></i>'})), (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 p3 = (x * height);
let p4 = (x - 1) * height; let p4 = (x - 1) * height;
faces[ii++] = p1; faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p2; faces[ii++] = p2;
faces[ii++] = p3;
faces[ii++] = p1; faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p4; faces[ii++] = p4;
faces[ii++] = p3;
} }
} }
// create bottom vertices & faces // create bottom vertices & faces
@ -407,11 +407,11 @@ KIRI.worker = {
let p3 = 0 + (y - 1); let p3 = 0 + (y - 1);
let p4 = 0 + (y - 0); let p4 = 0 + (y - 0);
faces[ii++] = p1; faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p2; faces[ii++] = p2;
faces[ii++] = p3;
faces[ii++] = p1; faces[ii++] = p1;
faces[ii++] = p3;
faces[ii++] = p4; faces[ii++] = p4;
faces[ii++] = p3;
} }
} }
// create right vertices & faces // create right vertices & faces

View file

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

View file

@ -349,6 +349,8 @@ kiri.lang['en-us'] = {
ct_wdth_l: "width in workspace units", ct_wdth_l: "width in workspace units",
ct_hght_s: "height", ct_hght_s: "height",
ct_hght_l: "height in workspace units", ct_hght_l: "height in workspace units",
ct_dpth_s: "depth",
ct_dpth_l: "distance in workspace units\nthat the tab projects from\nthe part surface",
ct_nabl_s: "auto", ct_nabl_s: "auto",
ct_nabl_l: "auto generate radial tabs\nprojected from part center\nusing count and angle offset", ct_nabl_l: "auto generate radial tabs\nprojected from part center\nusing count and angle offset",