From cfc1837627ba5c4da7244f625514615df443dd99 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 5 Oct 2022 23:38:48 -0400 Subject: [PATCH] merge touching pocket selections --- notes.md | 3 +++ release.md | 15 ++++--------- src/kiri-mode/cam/client.js | 1 + src/kiri-mode/cam/ops.js | 43 +++++++++++++++++-------------------- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/notes.md b/notes.md index c3123da7..c60dabbd 100644 --- a/notes.md +++ b/notes.md @@ -11,6 +11,7 @@ * `B` can't drag slider bar on ipad / ios -- touch pad scrolling dodgy * `B` prevent or ask for really large models when scaling (crash ui) +* `P` refactor vertex replacement and widget update matrix tracking * `P` duplicate objects should share same slice data unless rotated or scaled * `P` allow selection to be decimated on demand (context menu?) * `P` move all persisted / workspace settings/data to IndexedDB (LS limitations) @@ -106,6 +107,7 @@ * `F` gcode output option as zip for multiple or flip ops or tool change * `F` maintain several part orientations + op chains in a single profile +* `P` refactor slicing engine to use common core in geo * `P` port slicing to common core & refactor accordingly * `P` decrease cutting speed when entire tool is engaged (start of roughing) * `P` clear void should cut inside-to-out when a part would be freed from stock @@ -129,6 +131,7 @@ # Mesh:Tool +* add undo/redo * send to Kiri:Moto workspace (or update model vertices in place) * better z snap using just vertexes from face intersected * add section view. local clip. raycast skip points above plane diff --git a/release.md b/release.md index 24a63b5a..8ae013b9 100644 --- a/release.md +++ b/release.md @@ -3,13 +3,13 @@ Full docs @ https://docs.grid.space/projects/kiri-moto -# Release 3.5 (future) +# Release 3.5 (2022-10-07) ## Kiri:moto * add optional service workers and manifest to support full PWA + install * add support to run as Progressive Web Apps for installation and offline use -* add assembly import when KM used inside of Onshape +* add assembly import when KM used inside of onshape * add configurable flatness for contour clipping * add faster render mode for FDM slices * add axis label remapping in FDM @@ -20,8 +20,8 @@ Full docs @ https://docs.grid.space/projects/kiri-moto * add CAM pocket option to ignore interior features (outline only) * add CAM Z bottom visualization, make it relative to stock instead of part * add CAM z bottom inversion option to flip operator -* add CAM custom gcode operator -* add optional CAM operation notes +* add CAM custom gcode operator (can be used for pausing, too) +* add optional CAM operation notes (helps with many similar ops) * extend url loading of workspaces to all formats * alert when healing is enabled and non-manifold geometries are detected * fix thin output start and end point tracking which broke retraction @@ -29,13 +29,6 @@ Full docs @ https://docs.grid.space/projects/kiri-moto * fix profile seeding for newer device record formats * fix workspace import / restore for some file formats * fix potential crash into stock during moves when parts are z bottom anchored -* ~ refactor vertex replacement and widget update matrix tracking -* ~ refactor cnc to use core slicer engine -* ~ add cnc pause operator with control of park position - -## Mesh:Tool (1.3.0) - -* ~ undo / redo for some operations # Release 3.4 (2022-05-14) diff --git a/src/kiri-mode/cam/client.js b/src/kiri-mode/cam/client.js index cc66d608..d4a554ae 100644 --- a/src/kiri-mode/cam/client.js +++ b/src/kiri-mode/cam/client.js @@ -1487,6 +1487,7 @@ function updateStock(args, event) { side:THREE.DoubleSide }); camZBottom = new THREE.Mesh(geo, mat); + camZBottom._max = max; camZBottom.renderOrder = 1; camZBottom.position.x = csox; camZBottom.position.y = csoy; diff --git a/src/kiri-mode/cam/ops.js b/src/kiri-mode/cam/ops.js index fc1cd706..77895459 100644 --- a/src/kiri-mode/cam/ops.js +++ b/src/kiri-mode/cam/ops.js @@ -990,7 +990,7 @@ class OpPocket extends CamOp { } let zs = down ? base.util.lerp(zTop, z, down) : [ z ]; if (expand) polys = POLY.offset(polys, expand); - let zpro = 0, zinc = pinc / (polys.length * zs.length); + let zpro = 0, zinc = 1 / (polys.length * zs.length); for (let poly of polys) { for (let z of zs) { let shadow = shadowAt(z); @@ -1013,32 +1013,29 @@ class OpPocket extends CamOp { if (false) slice.output() .setLayer("pocket shadow", {line: 0xff8811}, false) .addPolys(shadow) - progress(prog + (zpro += zinc), "pocket"); + progress(zpro += zinc, "pocket"); } } } let surfaces = op.surfaces[widget.id] || []; let vert = widget.getVertices().array.map(v => v.round(4)); - let prog = 0, pinc= 1 / surfaces.length; - for (let surface of surfaces) { - let outline = []; - let faces = CAM.surface_find(widget, [surface]); - let zmin = Infinity; - let j=0, k=faces.length; - for (let face of faces) { - let i = face * 9; - outline.push(newPolygon() - .add(vert[i++], vert[i++], zmin = Math.min(zmin, vert[i++])) - .add(vert[i++], vert[i++], zmin = Math.min(zmin, vert[i++])) - .add(vert[i++], vert[i++], zmin = Math.min(zmin, vert[i++])) - ); - } - outline = POLY.union(outline, 0.0001, true); - outline = POLY.setWinding(outline, cutdir, false); - outline = healPolys(outline); - if (outline.length === 0) { - continue; - } + let outline = []; + let faces = CAM.surface_find(widget, surfaces); + let zmin = Infinity; + let j=0, k=faces.length; + for (let face of faces) { + let i = face * 9; + outline.push(newPolygon() + .add(vert[i++], vert[i++], zmin = Math.min(zmin, vert[i++])) + .add(vert[i++], vert[i++], zmin = Math.min(zmin, vert[i++])) + .add(vert[i++], vert[i++], zmin = Math.min(zmin, vert[i++])) + ); + } + outline = POLY.union(outline, 0.0001, true); + outline = POLY.setWinding(outline, cutdir, false); + outline = healPolys(outline); + let pinc = 1; + if (outline.length) { // option to skip interior features (holes, pillars) if (op.outline) { for (let p of outline) { @@ -1049,7 +1046,7 @@ class OpPocket extends CamOp { .setLayer("pocket area", {line: 0x1188ff}, false) .addPolys(outline) clearZ(outline, zmin + 0.0001, down); - progress(prog += pinc, "pocket"); + progress(1, "pocket"); } }