diff options
Diffstat (limited to 'svg-flatten/src/out_gerber.cpp')
-rw-r--r-- | svg-flatten/src/out_gerber.cpp | 18 |
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); |