From 855115ae42d458c0563ad6244f3c18ae771716ff Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 16 Nov 2020 11:00:52 -0500 Subject: [PATCH] add gcode path directional arrows and printing retracts --- notes.md | 2 -- package.json | 2 +- src/kiri/init.js | 18 ++++++++++++------ src/kiri/stacks.js | 2 +- src/license.js | 2 +- src/mode/fdm/prepare.js | 30 +++++++++++++++++++++++++++++- src/mode/sla/client.js | 4 ++-- web/kiri/lang/en.js | 2 ++ 8 files changed, 48 insertions(+), 14 deletions(-) diff --git a/notes.md b/notes.md index ca36f3fd..b87bf956 100644 --- a/notes.md +++ b/notes.md @@ -1,10 +1,8 @@ # Kiri:Moto todo ## 2.3 remaining -* path arrows, retracts, and engages * cap path ends * help dialog -* full bug reports * onshape mouse mapping option ## 2.4 diff --git a/package.json b/package.json index 5dfcd91a..f1264aa1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grid-apps", - "version": "2.3.10.D", + "version": "2.3.11.D", "description": "grid.space 3d slice & modeling tools", "author": "Stewart Allen ", "license": "MIT", diff --git a/src/kiri/init.js b/src/kiri/init.js index dd48306c..ea5d488d 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -1261,12 +1261,17 @@ text: $('alert-text') }, - act: { + func: { slice: $('act-slice'), preview: $('act-preview'), export: $('act-export') }, + acct: { + help: $('acct-help'), + export: $('acct-export') + }, + fps: $('fps'), load: $('load-file'), speeds: $('speeds'), @@ -2094,14 +2099,15 @@ $('set-device').onclick = (ev) => { ev.stopPropagation(); showSetup() }; $('set-tools').onclick = (ev) => { ev.stopPropagation(); showTools() }; $('set-prefs').onclick = (ev) => { ev.stopPropagation(); API.modal.show('prefs') }; - $('acct-help').onclick = (ev) => { ev.stopPropagation(); API.help.show() }; - $('acct-export').onclick = (ev) => { ev.stopPropagation(); profileExport() }; + UI.acct.help.onclick = (ev) => { ev.stopPropagation(); API.help.show() }; + UI.acct.export.onclick = (ev) => { ev.stopPropagation(); profileExport() }; + UI.acct.export.title = LANG.acct_xpo; $('file-recent').onclick = () => { API.modal.show('files') }; $('file-import').onclick = () => { API.event.import() }; UI.back.onclick = API.platform.layout; - UI.act.slice.onclick = (ev) => { ev.stopPropagation(); API.function.slice() }; - UI.act.preview.onclick = (ev) => { ev.stopPropagation(); API.function.print() }; - UI.act.export.onclick = (ev) => { ev.stopPropagation(); API.function.export() }; + UI.func.slice.onclick = (ev) => { ev.stopPropagation(); API.function.slice() }; + UI.func.preview.onclick = (ev) => { ev.stopPropagation(); API.function.print() }; + UI.func.export.onclick = (ev) => { ev.stopPropagation(); API.function.export() }; $('view-arrange').onclick = API.platform.layout; $('view-top').onclick = SPACE.view.top; $('view-home').onclick = SPACE.view.home; diff --git a/src/kiri/stacks.js b/src/kiri/stacks.js index f8c3c462..1d60593b 100644 --- a/src/kiri/stacks.js +++ b/src/kiri/stacks.js @@ -196,7 +196,7 @@ mesh.castShadow = true; mesh.receiveShadow = true; group.add(mesh); - ctrl.group.push(mat); + ctrl.group.appendAll(mat); } if (paths.length) { const mat = []; diff --git a/src/license.js b/src/license.js index 4cf89890..374c51f8 100644 --- a/src/license.js +++ b/src/license.js @@ -3,7 +3,7 @@ let terms = { COPYRIGHT: "Copyright (C) Stewart Allen - All Rights Reserved", LICENSE: "See the license.md file included with the source distribution", - VERSION: "2.3.D10" + VERSION: "2.3.D11" }; if (typeof(module) === 'object') { diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js index 09a55035..5271a552 100644 --- a/src/mode/fdm/prepare.js +++ b/src/mode/fdm/prepare.js @@ -377,7 +377,7 @@ print.output = output; print.render = FDM.prepareRender(output, progress => { update(0.5 + progress * 0.5); - }, { tools: device.extruders, thin: isThin, flat: isFlat }); + }, { tools: device.extruders, thin: isThin, flat: isFlat, fdm: true }); return print.render; }; @@ -447,6 +447,8 @@ levels.forEach((level, index) => { const prints = {}; const moves = []; + const heads = []; + const retracts = []; const output = new KIRI.Render(); layers.push(output); @@ -464,12 +466,18 @@ let emits = 0; level.forEach((out,oi) => { + if (out.retract) { + retracts.push(out.point); + } if (!out.point) { // in cam mode, these are drilling or dwell ops return; } if (lastOut) { + if (lastOut.emit !== out.emit) { + heads.push({p1: lastOut.point, p2: out.point}); + } const op = out.point, lp = lastOut.point, moved = (op.x !== lp.x) || (op.y !== lp.y) || (op.z !== lp.z);; if (out.emit) { @@ -506,6 +514,26 @@ pushPrint(lastOut.tool, current) } lastEnd = lastOut; + if (retracts.length) { + output + .setLayer('retract', { line: 0x550000, face: 0xff0000, opacity: 0.5 }, true) + .addAreas(retracts.map(point => { + return newPolygon().centerCircle(point, 0.2, 16).setZ(point.z + 0.01); + }), { outline: true }); + } + if (heads.length) { + output + .setLayer('arrows', { face: moveColor, line: 0x555555, opacity: 0.5 }, true) + .addAreas(heads.map(points => { + const {p1, p2} = points; + const slope = p2.slopeTo(p1); + const s1 = BASE.newSlopeFromAngle(slope.angle + 20); + const s2 = BASE.newSlopeFromAngle(slope.angle - 20); + const p3 = points.p2.projectOnSlope(s1, 0.4); + const p4 = points.p2.projectOnSlope(s2, 0.4); + return newPolygon().addPoints([p2,p3,p4]).setZ(p2.z + 0.01); + }), { thin: true, outline: true }); + } output .setLayer(opts.other || 'move', moveOpt, opts.moves !== true) .addPolys(moves, { thin: true, z: opts.z }); diff --git a/src/mode/sla/client.js b/src/mode/sla/client.js index d862e3d1..0b634617 100644 --- a/src/mode/sla/client.js +++ b/src/mode/sla/client.js @@ -12,9 +12,9 @@ SLA.init = function(kiri, api) { api.event.on("mode.set", (mode) => { if (mode === 'SLA') { - api.ui.act.preview.classList.add('hide'); + api.ui.func.preview.classList.add('hide'); } else { - api.ui.act.preview.classList.remove('hide'); + api.ui.func.preview.classList.remove('hide'); } }); }; diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index 3f533ed6..4784771b 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -5,6 +5,8 @@ kiri.lang['en-us'] = { version: "version", enable: "enable", + acct_xpo: "make a backup of your device\nand device profiles with the\noption to include workspace\nobjects and positions", + // DEVICE dialog groups dv_gr_dev: "device", dv_gr_ext: "extruder",