diff options
author | jaseg <git@jaseg.de> | 2021-04-25 14:03:16 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-04-25 14:03:16 +0200 |
commit | f2c891533f5179bf3d8a1625b1fe490a0cd06a42 (patch) | |
tree | d64bc014aa247d425c5f1f6c64e70144956b8317 /svg-flatten/src/main.cpp | |
parent | 1180ebdc1f18044a74f22f17b4d500ce7d6543fa (diff) | |
download | gerbolyze-f2c891533f5179bf3d8a1625b1fe490a0cd06a42.tar.gz gerbolyze-f2c891533f5179bf3d8a1625b1fe490a0cd06a42.tar.bz2 gerbolyze-f2c891533f5179bf3d8a1625b1fe490a0cd06a42.zip |
svg-flatten: Add outline/edge layer mode
Diffstat (limited to 'svg-flatten/src/main.cpp')
-rw-r--r-- | svg-flatten/src/main.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/svg-flatten/src/main.cpp b/svg-flatten/src/main.cpp index 722b356..3093d6a 100644 --- a/svg-flatten/src/main.cpp +++ b/svg-flatten/src/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char **argv) { "Print version and exit", 0}, {"ofmt", {"-o", "--format"}, - "Output format. Supported: gerber, svg, s-exp (KiCAD S-Expression)", + "Output format. Supported: gerber, gerber-outline (for board outline layer), svg, s-exp (KiCAD S-Expression)", 1}, {"precision", {"-p", "--precision"}, "Number of decimal places use for exported coordinates (gerber: 1-9, SVG: 0-*)", @@ -181,6 +181,7 @@ int main(int argc, char **argv) { bool force_flatten = false; bool is_sexp = false; + bool outline_mode = false; PolygonSink *sink = nullptr; PolygonSink *flattener = nullptr; PolygonSink *dilater = nullptr; @@ -189,10 +190,16 @@ int main(int argc, char **argv) { string clear_color = args["svg_clear_color"] ? args["svg_clear_color"].as<string>() : "#ffffff"; sink = new SimpleSVGOutput(*out_f, only_polys, precision, dark_color, clear_color); - } else if (fmt == "gbr" || fmt == "grb" || fmt == "gerber") { + } else if (fmt == "gbr" || fmt == "grb" || fmt == "gerber" || fmt == "gerber-outline") { + outline_mode = fmt == "gerber-outline"; + double scale = args["scale"].as<double>(1.0); - cerr << "loading @scale=" << scale << endl; - sink = new SimpleGerberOutput(*out_f, only_polys, 4, precision, scale, {0,0}, args["flip_gerber_polarity"]); + if (scale != 1.0) { + cerr << "loading @scale=" << scale << endl; + } + + sink = new SimpleGerberOutput( + *out_f, only_polys, 4, precision, scale, {0,0}, args["flip_gerber_polarity"], outline_mode); } else if (fmt == "s-exp" || fmt == "sexp" || fmt == "kicad") { if (!args["sexp_mod_name"]) { @@ -417,6 +424,7 @@ int main(int argc, char **argv) { min_feature_size, curve_tolerance, vec_sel, + outline_mode, }; SVGDocument doc; |