restore stock clipto for contouring

This commit is contained in:
Stewart Allen 2025-12-14 14:48:58 -05:00
commit b36dc4bf50
3 changed files with 15 additions and 5 deletions

View file

@ -99,6 +99,9 @@ export class Layers {
// a polygon rendered as a webgl line // a polygon rendered as a webgl line
addPolys(polys, options) { addPolys(polys, options) {
if (!polys) {
return this;
}
if (!Array.isArray(polys)) { if (!Array.isArray(polys)) {
throw "polys must be an array"; throw "polys must be an array";
} }

View file

@ -74,7 +74,13 @@ export class Topo {
clipTo = inside ? shadow.base : POLY.expand(shadow.base, toolDiameter / 2 + resolution * 3), clipTo = inside ? shadow.base : POLY.expand(shadow.base, 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),
debug_clips = false; debug_clips = true;
if (process.camStockClipTo) {
let { stock } = settings;
let { center, x, y } = stock;
clipTo.push(newPolygon().centerRectangle(center, x, y));
}
if (tolerance === 0 && !topoCache) { if (tolerance === 0 && !topoCache) {
console.log(widget.id, 'topo auto tolerance', resolution.round(4)); console.log(widget.id, 'topo auto tolerance', resolution.round(4));
@ -96,7 +102,7 @@ export class Topo {
if (debug_clips) { if (debug_clips) {
const debug = newSlice(-1); const debug = newSlice(-1);
const output = debug.output(); const output = debug.output();
// if (clipTab) output.setLayer("clip.tab", { line: 0xff0000 }).addPolys(clipTab); if (clipTab) output.setLayer("clip.tab", { line: 0xff0000 }).addPolys(clipTab);
if (clipTo) output.setLayer("clip.to", { line: 0x00dd00 }).addPolys(clipTo); if (clipTo) output.setLayer("clip.to", { line: 0x00dd00 }).addPolys(clipTo);
newslices.push(debug); newslices.push(debug);
} }
@ -742,15 +748,16 @@ export class Trace {
const object = this.object = this; const object = this.object = this;
this.inClip = function (clips, checkZ, point) { this.inClip = function (clips, checkZ, point) {
let ok = 0;
for (let i = 0; i < clips.length; i++) { for (let i = 0; i < clips.length; i++) {
let poly = clips[i]; let poly = clips[i];
let zok = checkZ ? checkZ <= poly.z : true; let zok = checkZ ? checkZ <= poly.z : true;
object.tabZ = poly.z; object.tabZ = poly.z;
if (zok && point.isInPolygon(poly)) { if (zok && point.isInPolygon(poly)) {
return true; ok++;
} }
} }
return false; return ok === clips.length;
} }
} }

View file

@ -838,7 +838,7 @@ self.lang['en-us'] = {
cs_offs_s: "offset", cs_offs_s: "offset",
cs_offs_l: ["use width, depth, height","as offsets from max","part size on platform"], cs_offs_l: ["use width, depth, height","as offsets from max","part size on platform"],
cs_clip_s: "clip to", cs_clip_s: "clip to",
cs_clip_l: ["rough and outline","clip cutting paths","to defined stock"], cs_clip_l: ["contour op only","clip cutting paths","to defined stock"],
cs_ishg_s: "show grid", cs_ishg_s: "show grid",
cs_ishg_l: ["show platform grid in indexed mode"], cs_ishg_l: ["show platform grid in indexed mode"],
cs_indx_s: "indexed", cs_indx_s: "indexed",