add gcode path directional arrows and printing retracts

This commit is contained in:
Stewart Allen 2020-11-16 11:00:52 -05:00
commit 855115ae42
8 changed files with 48 additions and 14 deletions

View file

@ -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

View file

@ -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 <sa@grid.space>",
"license": "MIT",

View file

@ -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;

View file

@ -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 = [];

View file

@ -3,7 +3,7 @@
let terms = {
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - 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') {

View file

@ -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 });

View file

@ -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');
}
});
};

View file

@ -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",