fix multiple tab heights in contouring

This commit is contained in:
Stewart Allen 2020-11-28 10:35:46 -05:00
commit 0842d235a3
4 changed files with 17 additions and 10 deletions

View file

@ -66,7 +66,6 @@
# CAM # CAM
* `B` fix multiple tab heights in contouring (uses highest now)
* `B` climb vs conventional not fully consistent after refactor * `B` climb vs conventional not fully consistent after refactor
* `B` outside cutting direction in roughing mode inverted * `B` outside cutting direction in roughing mode inverted
* `B` clear voids has double interior pass because wrong offset shadow used * `B` clear voids has double interior pass because wrong offset shadow used

View file

@ -1614,7 +1614,7 @@
sliceSolidMinArea: UC.newInput(LANG.ad_msol_s, {title:LANG.ad_msol_l, convert:UC.toFloat, modes:FDM, expert:true}), sliceSolidMinArea: UC.newInput(LANG.ad_msol_s, {title:LANG.ad_msol_l, convert:UC.toFloat, modes:FDM, expert:true}),
outputMinSpeed: UC.newInput(LANG.ad_mins_s, {title:LANG.ad_mins_l, bound:UC.bound(5,200), convert:UC.toFloat, modes:FDM, expert:true}), outputMinSpeed: UC.newInput(LANG.ad_mins_s, {title:LANG.ad_mins_l, bound:UC.bound(5,200), convert:UC.toFloat, modes:FDM, expert:true}),
outputCoastDist: UC.newInput(LANG.ad_scst_s, {title:LANG.ad_scst_l, bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM, expert:true}), outputCoastDist: UC.newInput(LANG.ad_scst_s, {title:LANG.ad_scst_l, bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM, expert:true}),
outputShortPoly: UC.newInput(LANG.ad_spol_s, {title:LANG.ad_spol_l, bound:UC.bound(0,200), convert:UC.toFloat, modes:FDM, expert:true}), outputShortPoly: UC.newInput(LANG.ad_spol_s, {title:LANG.ad_spol_l, bound:UC.bound(0,10000), convert:UC.toFloat, modes:FDM, expert:true}),
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}), zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}),
antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM, expert:true}), antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM, expert:true}),

View file

@ -148,7 +148,7 @@
let terrain = slicer.slice(tzindex, { each: (data, index, total) => { let terrain = slicer.slice(tzindex, { each: (data, index, total) => {
tshadow = POLY.union(tshadow.appendAll(data.tops), 0.01, true); tshadow = POLY.union(tshadow.appendAll(data.tops), 0.01, true);
tslices.push(data.slice); tslices.push(data.slice);
if (true) { if (false) {
const slice = data.slice; const slice = data.slice;
sliceAll.push(slice); sliceAll.push(slice);
slice.output() slice.output()

View file

@ -74,7 +74,11 @@
debug_topo_shells = debug && true; debug_topo_shells = debug && true;
if (tabs) { if (tabs) {
clipTab.appendAll(tabs.map(tab => POLY.expand([tab.poly], toolDiameter/2)).flat()); clipTab.appendAll(tabs.map(tab => {
let ctab = POLY.expand([tab.poly], toolDiameter/2);
ctab.forEach(ct => ct.z = tab.dim.z);
return ctab;
}).flat());
} }
// debug clipTab and clipTo // debug clipTab and clipTo
@ -257,16 +261,20 @@
} }
const checkr = newPoint(0,0); const checkr = newPoint(0,0);
const inClip = function(polys) { const inClip = function(polys, checkZ) {
checkr.x = x; checkr.x = x;
checkr.y = y; checkr.y = y;
for (let i=0; i<polys.length; i++) { for (let i=0; i<polys.length; i++) {
if (checkr.isInPolygon(polys[i])) { let poly = polys[i];
let zok = checkZ ? checkZ <= poly.z : true;
tabZ = poly.z;
if (zok && checkr.isInPolygon(poly)) {
return true; return true;
} }
} }
return false; return false;
}; };
let tabZ;
// x contouring // x contouring
if (proc.camContourXOn) { if (proc.camContourXOn) {
@ -284,8 +292,8 @@
tv = toolAtZ(gridx, gridy); tv = toolAtZ(gridx, gridy);
// when tabs are on and this point is inside the // when tabs are on and this point is inside the
// tab polygon, ensure z is at least tabHeight // tab polygon, ensure z is at least tabHeight
if (tabsOn && tv < tabHeight && inClip(clipTab)) { if (tabsOn && tv < tabHeight && inClip(clipTab, tv)) {
tv = tabHeight; tv = tabZ;//tabHeight;
} }
// if the value is on the floor and inside the clip // if the value is on the floor and inside the clip
// poly (usually shadow), end the segment // poly (usually shadow), end the segment
@ -325,8 +333,8 @@
sliceout = []; sliceout = [];
for (x = minX - partOff; x <= maxX + partOff; x += resolution) { for (x = minX - partOff; x <= maxX + partOff; x += resolution) {
tv = toolAtZ(gridx, gridy); tv = toolAtZ(gridx, gridy);
if (tabsOn && tv < tabHeight && inClip(clipTab)) { if (tabsOn && tv < tabHeight && inClip(clipTab, tv)) {
tv = tabHeight; tv = tabZ;
} }
if (clipTo && !inClip(clipTo)) { if (clipTo && !inClip(clipTo)) {
end_poly(); end_poly();