align tabs to a common center. fix tab height when z bottom in topo
This commit is contained in:
parent
dab123d0a6
commit
8d05cb7a2b
2 changed files with 9 additions and 7 deletions
|
|
@ -135,6 +135,7 @@
|
||||||
updateOp(index, total);
|
updateOp(index, total);
|
||||||
}, genso: true });
|
}, genso: true });
|
||||||
let shadowTop = terrain[terrain.length - 1];
|
let shadowTop = terrain[terrain.length - 1];
|
||||||
|
let center = tshadow[0].bounds.center();
|
||||||
|
|
||||||
if (procDrillReg) {
|
if (procDrillReg) {
|
||||||
maxToolDiam = Math.max(maxToolDiam, drillToolDiam);
|
maxToolDiam = Math.max(maxToolDiam, drillToolDiam);
|
||||||
|
|
@ -275,7 +276,7 @@
|
||||||
if (outside) {
|
if (outside) {
|
||||||
offset.appendAll(outside);
|
offset.appendAll(outside);
|
||||||
if (addTabsOutline && slice.z <= zMin + tabHeight) {
|
if (addTabsOutline && slice.z <= zMin + tabHeight) {
|
||||||
offset = addCutoutTabs(offset, slice.z, roughToolDiam, tabWidth, proc.camTabsCount, proc.camTabsAngle, slice);
|
offset = addCutoutTabs(offset, slice.z, center, roughToolDiam, tabWidth, proc.camTabsCount, proc.camTabsAngle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +384,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addTabsOutline && slice.z <= zMin + tabHeight) {
|
if (addTabsOutline && slice.z <= zMin + tabHeight) {
|
||||||
offset = addCutoutTabs(offset, slice.z, outlineToolDiam, tabWidth, proc.camTabsCount, proc.camTabsAngle);
|
offset = addCutoutTabs(offset, slice.z, center, outlineToolDiam, tabWidth, proc.camTabsCount, proc.camTabsAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// offset.xout(`slice ${slice.z}`);
|
// offset.xout(`slice ${slice.z}`);
|
||||||
|
|
@ -413,7 +414,8 @@
|
||||||
ondone: (slices) => {
|
ondone: (slices) => {
|
||||||
sliceAll.appendAll(slices);
|
sliceAll.appendAll(slices);
|
||||||
},
|
},
|
||||||
shadow: tshadow
|
shadow: tshadow,
|
||||||
|
center: center
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -534,7 +536,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// cut outside traces at the right points
|
// cut outside traces at the right points
|
||||||
function addCutoutTabs(polys, z, toolDiam, tabWidth, tabCount, tabAngle, slice) {
|
function addCutoutTabs(polys, z, center, toolDiam, tabWidth, tabCount, tabAngle, slice) {
|
||||||
// skip if no tops | traces
|
// skip if no tops | traces
|
||||||
if (polys.length === 0) return polys;
|
if (polys.length === 0) return polys;
|
||||||
|
|
||||||
|
|
@ -546,7 +548,6 @@
|
||||||
trace.setClockwise();
|
trace.setClockwise();
|
||||||
|
|
||||||
let ints = [];
|
let ints = [];
|
||||||
let center = trace.bounds.center(z);
|
|
||||||
CAM.createTabLines(center, toolDiam, tabWidth, tabCount, tabAngle).forEach(tab => {
|
CAM.createTabLines(center, toolDiam, tabWidth, tabCount, tabAngle).forEach(tab => {
|
||||||
const {c1, c2, o1, o2} = tab,
|
const {c1, c2, o1, o2} = tab,
|
||||||
int1 = trace.intersections(c1, o1).pop(),
|
int1 = trace.intersections(c1, o1).pop(),
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,12 @@
|
||||||
},
|
},
|
||||||
newslices = [],
|
newslices = [],
|
||||||
tabsOn = proc.camTabsOn,
|
tabsOn = proc.camTabsOn,
|
||||||
tabHeight = proc.camTabsHeight,
|
tabHeight = proc.camTabsHeight + zBottom,
|
||||||
clipTab = tabsOn ? [] : null,
|
clipTab = tabsOn ? [] : null,
|
||||||
clipTo = inside ? shadow : POLY.expand(shadow, toolDiameter/2 + resolution * 3),
|
clipTo = inside ? shadow : POLY.expand(shadow, toolDiameter/2 + resolution * 3),
|
||||||
partOff = inside ? 0 : toolDiameter / 2 + resolution,
|
partOff = inside ? 0 : toolDiameter / 2 + resolution,
|
||||||
gridDelta = Math.floor(partOff / resolution),
|
gridDelta = Math.floor(partOff / resolution),
|
||||||
|
center = opt.center,
|
||||||
debug = false,
|
debug = false,
|
||||||
debug_clips = debug && true,
|
debug_clips = debug && true,
|
||||||
debug_topo = debug && false,
|
debug_topo = debug && false,
|
||||||
|
|
@ -72,7 +73,7 @@
|
||||||
|
|
||||||
if (proc.camTabsOn) {
|
if (proc.camTabsOn) {
|
||||||
CAM.createTabLines(
|
CAM.createTabLines(
|
||||||
clipTo[0].bounds.center(),
|
center,
|
||||||
toolDiameter,
|
toolDiameter,
|
||||||
proc.camTabsWidth,
|
proc.camTabsWidth,
|
||||||
proc.camTabsCount,
|
proc.camTabsCount,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue