From 670c0c78224fb2160e9da02019f17098f6b9b6af Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Thu, 12 Mar 2020 09:57:01 -0400 Subject: [PATCH] limit tracing to wholly consume paths for now. omit topo when drilling only --- js/kiri-driver-cam.js | 39 ++++++++++++++++++++++++++------------- js/kiri-init.js | 4 +++- notes.md | 16 +++++----------- readme.md | 2 +- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/js/kiri-driver-cam.js b/js/kiri-driver-cam.js index 9bcd5175..48b3d177 100644 --- a/js/kiri-driver-cam.js +++ b/js/kiri-driver-cam.js @@ -710,9 +710,12 @@ let gs_kiri_cam = exports; /** * Find top paths to trace when using ball and taper mills - * in waterline finishing mode. + * in waterline finishing and tracing modes. */ - function findTracingPaths(widget, slice, tool, profile) { + function findTracingPaths(widget, slice, tool, profile, partial) { + // for now, only emit completed polys and not segments + // TODO consider limiting to nup path lengths that are >= tool radius + let only_whole = !partial; // check for ball and taper mills paths and add to top[0].inner let polys = []; let nups = []; @@ -724,13 +727,14 @@ let gs_kiri_cam = exports; let np = newPolygon().setOpen(); let mp = 0; // find top poly segments that are not significantly offset - // my tool profile and add to new polygons which accumulate + // from tool profile and add to new polygons which accumulate // to the top inner array poly.forEachSegment((p1,p2) => { let nz = getTopoZPathMax(widget, profile, p1.x, p1.y, p2.x, p2.y); if (nz > mz) { mz = nz; } + // this # should be computed from topo resolution if (nz - pz < 0.01) { mp++ if (np.length) { @@ -743,7 +747,9 @@ let gs_kiri_cam = exports; np.append(p1).append(p2); } } else if (np.length) { - nups.append(np); + if (!only_whole) { + nups.append(np); + } np = newPolygon().setOpen(); } }); @@ -758,8 +764,13 @@ let gs_kiri_cam = exports; if (np.isClosed() && parent) { // console.log(slice.z,'cull',poly); parent.inner = parent.inner.filter(p => p !== poly); + if (only_whole) { + nups.append(np); + } + } + if (!only_whole) { + nups.append(np); } - nups.append(np); } }); if (nups.length) { @@ -1022,7 +1033,9 @@ let gs_kiri_cam = exports; onupdate(0.0 + update * 0.25, "slicing"); }); - // we need topo for safe travel moves + // we need topo for safe travel moves when roughing and finishing + // not generated when drilling-only. then all z moves use bounds max + if (procRough || anyFinish) generateTopoMap(widget, settings, function(slices) { sliceAll.appendAll(slices); // todo union rough / finish shells @@ -1055,9 +1068,7 @@ let gs_kiri_cam = exports; if (addTabsRough) addCutoutTabs(slice, roughToolDiam); break; case CPRO.FINISH: - if (profile) { - findTracingPaths(widget, slice, tool, profile); - } + if (profile) findTracingPaths(widget, slice, tool, profile); createFinishingSlices(slice, shellFinish, finishToolDiam, pocketOnlyFinish); if (addTabsFinish) addCutoutTabs(slice, finishToolDiam); break; @@ -1153,8 +1164,10 @@ let gs_kiri_cam = exports; if (toolID !== lastTool) { tool = getToolById(settings, toolID); toolDiam = getToolDiameter(settings, toolID); - toolDiamMove = toolDiam, // TODO validate w/ multiple models - toolProfile = createToolProfile(settings, toolID, widget.topo); + toolDiamMove = toolDiam; // TODO validate w/ multiple models + if (widget.topo) { + toolProfile = createToolProfile(settings, toolID, widget.topo); + } lastTool = toolID; } feedRate = feed; @@ -1267,7 +1280,7 @@ let gs_kiri_cam = exports; } //else (TODO verify no else here b/c above could change isMove) // move over things if ((deltaXY > toolDiam || (deltaZ > toolDiam && deltaXY > tolerance)) && (isMove || absDeltaZ >= tolerance)) { - let maxz = MAX( + let maxz = toolProfile ? MAX( getTopoZPathMax( widget, toolProfile, @@ -1276,7 +1289,7 @@ let gs_kiri_cam = exports; point.x, point.y) + zadd, point.z, - lastPoint.z), + lastPoint.z) : zmax + zadd, mustGoUp = MAX(maxz - point.z, maxz - lastPoint.z) >= tolerance, clearz = maxz; // up if any point between higher than start/finish diff --git a/js/kiri-init.js b/js/kiri-init.js index dde3ed7f..2c4cb6bb 100644 --- a/js/kiri-init.js +++ b/js/kiri-init.js @@ -1302,7 +1302,9 @@ var gs_kiri_init = exports; }; UI.toolsSave.onclick = function() { if (selectedTool) updateTool(); - settings().tools = editTools; + settings().tools = editTools.sort((a,b) => { + return a.name < b.name ? -1 : 1; + }); setToolChanged(false); API.conf.save(); API.view.update_fields(); diff --git a/notes.md b/notes.md index ad83ffc1..03a11278 100644 --- a/notes.md +++ b/notes.md @@ -9,7 +9,6 @@ * bail on decimation if it's proving ineffective * improve decimation speed by avoiding in/out of Point * server-side processing (determine protocol and storage) -* move printing/output into module * refactor / simplify POLY.expand (put onus on collector) * cloned objects should share same slice data unless rotated * remember object's original position/orientation for reset/multi-object import alignment @@ -39,15 +38,13 @@ * refactor slicing around flats w/ interpolation instead of culling * optimize away topo generation (for z hop/move) when part is flat -* add imperial / metric units switch in (future) global config options * add option to spiral in vs out (optimal tool life) vs mixed (optimal path) * ease-in and ease-out especially on tab cut-out start/stop -* import options: unify bodies. * milling order option: by operation or by part * store tab and camshell polys in widget.topo to minimize z on edge moves -* trimming linear finishing to tabs -* improve 'clockwise' setting to take into account spindle direction, etc -* linear finishing cutting out tabs +* add endmill spiral direction to influence next point +* improve 'clockwise' setting to take into account spindle direction, etc (climb/conventional) +* lead-in milling * linear finishing going back to z top too often * fix ease down and re-enable (need failure case) * warn when part > stock or cuts go outside bed @@ -57,16 +54,13 @@ * crossing open space check point is outside camshell before returning max z * compensate for leave-stock in outside roughing (w/ tabs) * fix zooming, workspace thickness for larger workspaces -* raise z by leave-stock in roughing? if so, see next -* if (raise z) above, add clear-flats to finishing -* revisit tabs - just cut polys instead -* try chunking topo until smaller blocks for processing (fit in cacheline) -* linear x/y scan overflow (y) w/ topo model * linear x/y not obeying inset from pocket only * check normals for downward facing facets. mark top for slice skirt/pancake # Laser todo +* add proper devices +* color coding according to # of identical polys that show up in stacked layers * overcuts, radii for drag knives * sla :: svg modified from http://garyhodgson.github.io/slic3rsvgviewer/?file=examples/belt_pulley3.svg diff --git a/readme.md b/readme.md index cddbf26e..2e58ccc0 100644 --- a/readme.md +++ b/readme.md @@ -27,7 +27,7 @@ then access the apps from http://debug:8080/ ## More Information -* [Facebook Group](https://www.facebook.com/groups/660020084206828/) +* [Facebook Group](https://www.facebook.com/groups/kirimoto/) * [YouTube Tutorials](https://www.youtube.com/c/gridspace) * [Twitter](https://twitter.com/grid_space_3d) * [Wiki](https://github.com/GridSpace/grid-apps/wiki)