From bd3876408327772b2a27c1d0c9d05435e76a42d7 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 2 Dec 2020 18:05:31 -0500 Subject: [PATCH] prevent tabs from hover detection in tracing. heal open segments that share endpoints after tab cuts --- src/kiri/print.js | 2 +- src/mode/cam/client.js | 3 +++ src/mode/cam/slice.js | 44 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/kiri/print.js b/src/kiri/print.js index dc2ccbaa..c49c1140 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -833,7 +833,7 @@ } return; } - let area = poly.area(); + let area = poly.open ? 1 : poly.area(); poly.forEachPoint(function(point, index) { dist = opt.weight ? startPoint.distTo3D(point) * area * area : diff --git a/src/mode/cam/client.js b/src/mode/cam/client.js index 10dbef30..9553b557 100644 --- a/src/mode/cam/client.js +++ b/src/mode/cam/client.js @@ -320,6 +320,9 @@ lastTrace = null; return; } + if (!data.int.object.trace) { + return; + } lastTrace = data.int.object; if (lastTrace.selected) { let event = data.event; diff --git a/src/mode/cam/slice.js b/src/mode/cam/slice.js index 0a8d2de0..9f00381e 100644 --- a/src/mode/cam/slice.js +++ b/src/mode/cam/slice.js @@ -45,7 +45,6 @@ procContour = procContourX || procContourY, procDrill = proc.camDrillingOn && proc.camDrillDown && proc.camDrillDownSpeed, procDrillReg = proc.camDrillReg, - // procTrace = proc.camTraceOn, roughDown = procRough ? proc.camRoughDown : Infinity, outlineDown = procOutline ? proc.camOutlineDown : Infinity, sliceDepth = Math.max(0.1, Math.min(roughDown, outlineDown) / 3), @@ -738,6 +737,49 @@ let noff = []; tabs = tabs.filter(tab => z < tab.pos.z + tab.dim.z/2).map(tab => tab.off).flat(); offset.forEach(op => noff.appendAll( op.cut(POLY.union(tabs)) )); + if (noff.length > 1) { + let heal = 0; + // heal/rejoin open segments that share endpoints + outer: for(;; heal++) { + let ntmp = noff, tlen = ntmp.length; + for (let i=0; i 0) { + // cull nulls + noff = noff.filter(o => o); + } + } return noff; }