allow nested M808 loops. expand object values in gcode. bump rev 3.0.D29
This commit is contained in:
parent
9777514dd9
commit
8cd62d8b44
5 changed files with 43 additions and 37 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "grid-apps",
|
||||
"version": "3.0.28D",
|
||||
"version": "3.0.29D",
|
||||
"description": "grid.space 3d slice & modeling tools",
|
||||
"author": "Stewart Allen <sa@grid.space>",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
if (!self.kiri) {
|
||||
self.kiri = {
|
||||
beta: 3028,
|
||||
beta: 3029,
|
||||
driver: {}, // driver modules
|
||||
loader: [] // module loading: array of functions
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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: "3.0.D28"
|
||||
VERSION: "3.0.D29"
|
||||
};
|
||||
|
||||
if (typeof(module) === 'object') {
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@
|
|||
append(`; Target: ${settings.filter[settings.mode]}`);
|
||||
append("; --- process ---");
|
||||
for (let pk in spro) {
|
||||
if (pk !== "ops") {
|
||||
if (pk !== "ops" && pk !== "op2") {
|
||||
append("; " + pk + " = " + spro[pk]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
bytes = 0,
|
||||
bcos = Math.cos(Math.PI/4),
|
||||
icos = 1 / bcos,
|
||||
inLoop,
|
||||
inloops = 0,
|
||||
arcQ = [],
|
||||
minz = { x: Infinity, y: Infinity, z: Infinity };
|
||||
|
||||
|
|
@ -142,27 +142,29 @@
|
|||
});
|
||||
}
|
||||
|
||||
// collect loops from ranges and synth range array
|
||||
let rloops = [];
|
||||
if (loops > 0) {
|
||||
// if loops set, loop entire part
|
||||
rloops.push({
|
||||
start: layers[0].slice.index,
|
||||
end: layers.last().slice.index,
|
||||
iter: loops - 1
|
||||
});
|
||||
}
|
||||
if (process.ranges)
|
||||
for (let range of process.ranges) {
|
||||
if (range.fields.outputLoops) {
|
||||
rloops.push({
|
||||
start: range.lo,
|
||||
end: range.hi,
|
||||
iter: range.fields.outputLoops - 1
|
||||
});
|
||||
if (process.ranges) {
|
||||
// collect loops from ranges and synth range array
|
||||
for (let range of process.ranges) {
|
||||
if (range.fields.outputLoops) {
|
||||
rloops.push({
|
||||
start: range.lo,
|
||||
end: range.hi,
|
||||
iter: range.fields.outputLoops - 1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
loops = isBelt && rloops.length ? rloops : undefined;
|
||||
|
||||
console.log({loops});
|
||||
(process.gcodePauseLayers || "").split(",").forEach(function(lv) {
|
||||
let v = parseInt(lv);
|
||||
if (v >= 0) pause.push(v);
|
||||
|
|
@ -200,6 +202,13 @@
|
|||
arr.forEach(function(line) { appendSub(line, pad) });
|
||||
}
|
||||
|
||||
function appendTok() {
|
||||
let arg = [...arguments].map(v => {
|
||||
return typeof(v) === 'object' ? JSON.stringify(v) : v;
|
||||
});
|
||||
append(arg.join(''));
|
||||
}
|
||||
|
||||
append(`; Generated by Kiri:Moto ${KIRI.version}`);
|
||||
append(`; ${new Date().toString()}`);
|
||||
appendSub("; Bed left:{left} right:{right} top:{top} bottom:{bottom}");
|
||||
|
|
@ -217,7 +226,8 @@
|
|||
}
|
||||
append("; --- process ---");
|
||||
for (let pk in process) {
|
||||
append("; " + pk + " = " + process[pk]);
|
||||
// append("; " + pk + " = " + process[pk]);
|
||||
appendTok("; ", pk, " = ", process[pk]);
|
||||
}
|
||||
append("; --- startup ---");
|
||||
let t0 = false;
|
||||
|
|
@ -397,26 +407,23 @@
|
|||
appendAllSub(pauseCmd)
|
||||
}
|
||||
|
||||
let endloop = false;
|
||||
let endloop = 0;
|
||||
if (loops) {
|
||||
if (inLoop) {
|
||||
if (layerno === inLoop.end) {
|
||||
endloop = true;
|
||||
// append(`M808`);
|
||||
// inLoop = undefined;
|
||||
}
|
||||
} else {
|
||||
for (let loop of loops) {
|
||||
if (layerno === loop.start) {
|
||||
append(`M808 L${loop.iter}`);
|
||||
if (extrudeAbs) {
|
||||
append(`G92 Z${lout.z.round(decimals)} E${outputLength.round(decimals)}`);
|
||||
} else {
|
||||
append(`G92 Z${lout.z.round(decimals)}`);
|
||||
}
|
||||
inLoop = loop;
|
||||
break;
|
||||
for (let loop of loops) {
|
||||
if (layerno === loop.start && !loop.started) {
|
||||
loop.started = true;
|
||||
append(`M808 L${loop.iter}`);
|
||||
if (extrudeAbs) {
|
||||
append(`G92 Z${lout.z.round(decimals)} E${outputLength.round(decimals)}`);
|
||||
} else {
|
||||
append(`G92 Z${lout.z.round(decimals)}`);
|
||||
}
|
||||
inloops++;
|
||||
}
|
||||
if (layerno === loop.end && !loop.ended) {
|
||||
loop.ended = true;
|
||||
endloop++;
|
||||
inloops--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -649,9 +656,8 @@
|
|||
layer++;
|
||||
|
||||
// end open loop when detected
|
||||
if (endloop) {
|
||||
while (endloop-- > 0) {
|
||||
append(`M808`);
|
||||
inLoop = undefined;
|
||||
}
|
||||
drainQ();
|
||||
}
|
||||
|
|
@ -784,7 +790,7 @@
|
|||
|
||||
}
|
||||
|
||||
if (inLoop) {
|
||||
if (inloops) {
|
||||
append(`M808`);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue