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) |
|
let color = ((rgb.r * 0xff) << 16) |
|
||||||
((rgb.g * 0xff) << 8) |
|
((rgb.g * 0xff) << 8) |
|
||||||
((rgb.b * 0xff) << 0);
|
((rgb.b * 0xff) << 0);
|
||||||
|
if (opt.flat) {
|
||||||
|
poly = poly.clone().setZ(0);
|
||||||
|
}
|
||||||
if (opt.aslines) {
|
if (opt.aslines) {
|
||||||
emits.poly(poly, opt.color || color, false, true);
|
emits.poly(poly, opt.color || color, false, true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@
|
||||||
e = o.point;
|
e = o.point;
|
||||||
e.x += p.max.w / 2 - m.fit.x;
|
e.x += p.max.w / 2 - m.fit.x;
|
||||||
e.y += p.max.h / 2 - m.fit.y;
|
e.y += p.max.h / 2 - m.fit.y;
|
||||||
e.z = 0;
|
// e.z = 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -348,7 +348,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function exportSVG(print, cut_color) {
|
function exportSVG(print, cut_color) {
|
||||||
let lines = [], dx = 0, dy = 0, my;
|
let lines = [], dx = 0, dy = 0, my, z = 0;
|
||||||
let colors = [
|
let colors = [
|
||||||
"black",
|
"black",
|
||||||
"purple",
|
"purple",
|
||||||
|
|
@ -375,12 +375,13 @@
|
||||||
},
|
},
|
||||||
function(poly, color) {
|
function(poly, color) {
|
||||||
let cout = colors[((color-1) % colors.length)];
|
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() {
|
function() {
|
||||||
lines.push("</svg>");
|
lines.push("</svg>");
|
||||||
},
|
},
|
||||||
function(point) {
|
function(point) {
|
||||||
|
z = point.z;
|
||||||
return UTIL.round(point.x - dx, 3) + "," + UTIL.round(my - point.y - dy, 3);
|
return UTIL.round(point.x - dx, 3) + "," + UTIL.round(my - point.y - dy, 3);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -459,7 +460,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
function printRender(print) {
|
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