aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/out_gerber.cpp
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-04-25 14:41:06 +0200
committerjaseg <git@jaseg.de>2021-04-25 14:41:06 +0200
commit1d6d4e4f14b395b7a16802ac909687dfa2b447e4 (patch)
tree3c20d6feb569d1011ba9ba4164f1d5d04e9fa5fa /svg-flatten/src/out_gerber.cpp
parent046e827be1bec795ab5baf064744be3dc011f0e9 (diff)
downloadgerbolyze-1d6d4e4f14b395b7a16802ac909687dfa2b447e4.tar.gz
gerbolyze-1d6d4e4f14b395b7a16802ac909687dfa2b447e4.tar.bz2
gerbolyze-1d6d4e4f14b395b7a16802ac909687dfa2b447e4.zip
svg-flatten: Add support for line thickness to board outline exporter
Diffstat (limited to 'svg-flatten/src/out_gerber.cpp')
-rw-r--r--svg-flatten/src/out_gerber.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/svg-flatten/src/out_gerber.cpp b/svg-flatten/src/out_gerber.cpp
index 94c01de..f842e15 100644
--- a/svg-flatten/src/out_gerber.cpp
+++ b/svg-flatten/src/out_gerber.cpp
@@ -34,7 +34,9 @@ SimpleGerberOutput::SimpleGerberOutput(ostream &out, bool only_polys, int digits
m_offset(offset),
m_scale(scale),
m_flip_pol(flip_polarity),
- m_outline_mode(outline_mode)
+ m_outline_mode(outline_mode),
+ m_current_aperture(0.0),
+ m_aperture_num(10) /* See gerber standard */
{
assert(1 <= digits_int && digits_int <= 9);
assert(0 <= digits_frac && digits_frac <= 9);
@@ -59,6 +61,20 @@ void SimpleGerberOutput::header_impl(d2p origin, d2p size) {
m_out << "D10*" << endl;
}
+SimpleGerberOutput& SimpleGerberOutput::operator<<(const ApertureToken &ap) {
+ if (ap.m_size == m_current_aperture) {
+ return *this;
+ }
+ m_current_aperture = ap.m_size;
+ m_aperture_num += 1;
+
+ double size = (ap.m_size > 0.0) ? ap.m_size : 0.05;
+ m_out << "%ADD" << m_aperture_num << "C," << size << "*%" << endl;
+ m_out << "D" << m_aperture_num << "*" << endl;
+
+ return *this;
+}
+
SimpleGerberOutput& SimpleGerberOutput::operator<<(GerberPolarityToken pol) {
assert(pol == GRB_POL_DARK || pol == GRB_POL_CLEAR);