add z index hints to svg output
This commit is contained in:
parent
0c34073965
commit
f9336c7afd
2 changed files with 8 additions and 4 deletions
|
|
@ -1361,6 +1361,9 @@
|
|||
let color = ((rgb.r * 0xff) << 16) |
|
||||
((rgb.g * 0xff) << 8) |
|
||||
((rgb.b * 0xff) << 0);
|
||||
if (opt.flat) {
|
||||
poly = poly.clone().setZ(0);
|
||||
}
|
||||
if (opt.aslines) {
|
||||
emits.poly(poly, opt.color || color, false, true);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@
|
|||
e = o.point;
|
||||
e.x += p.max.w / 2 - m.fit.x;
|
||||
e.y += p.max.h / 2 - m.fit.y;
|
||||
e.z = 0;
|
||||
// e.z = 0;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -348,7 +348,7 @@
|
|||
*
|
||||
*/
|
||||
function exportSVG(print, cut_color) {
|
||||
let lines = [], dx = 0, dy = 0, my;
|
||||
let lines = [], dx = 0, dy = 0, my, z = 0;
|
||||
let colors = [
|
||||
"black",
|
||||
"purple",
|
||||
|
|
@ -375,12 +375,13 @@
|
|||
},
|
||||
function(poly, color) {
|
||||
let cout = colors[((color-1) % colors.length)];
|
||||
lines.push(`<polyline points="${poly.join(' ')}" fill="none" stroke="${cout}" stroke-width="0.1mm" />`);
|
||||
lines.push(`<polyline z="${z}" points="${poly.join(' ')}" fill="none" stroke="${cout}" stroke-width="0.1mm" />`);
|
||||
},
|
||||
function() {
|
||||
lines.push("</svg>");
|
||||
},
|
||||
function(point) {
|
||||
z = point.z;
|
||||
return UTIL.round(point.x - dx, 3) + "," + UTIL.round(my - point.y - dy, 3);
|
||||
}
|
||||
);
|
||||
|
|
@ -459,7 +460,7 @@
|
|||
};
|
||||
|
||||
function printRender(print) {
|
||||
return KIRI.driver.FDM.printRender(print, {aslines: true, nomoves: true});
|
||||
return KIRI.driver.FDM.printRender(print, {aslines: true, nomoves: true, flat: true});
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue