I moved the file generating lines inside the svg loop like so;
// Loop over pens backwards to display dark lines last.
// Then loop over all displayed lines.
for (int p=pen_count-1; p>=0; p--) {
String gname = "gcode\\gcode_" + basefile_selected + p + ".svg";
OUTPUT = createWriter(sketchPath("") + gname);
OUTPUT.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
OUTPUT.println("<svg width=\"" + svg_format(img.width * gcode_scale) + "mm\" height=\"" + svg_format(img.height * gcode_scale) + "mm\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">");
It seems to work. Keeping in mind that I read code like a first grader, have I done this right?
|