From 454d587d795aef529c04d6c250219ed288f02228 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 29 Mar 2023 15:54:00 +0200 Subject: svg-flatten: Optimize output aperture count --- svg-flatten/src/out_gerber.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'svg-flatten') diff --git a/svg-flatten/src/out_gerber.cpp b/svg-flatten/src/out_gerber.cpp index 30518b1..4293d82 100644 --- a/svg-flatten/src/out_gerber.cpp +++ b/svg-flatten/src/out_gerber.cpp @@ -34,7 +34,7 @@ SimpleGerberOutput::SimpleGerberOutput(ostream &out, bool only_polys, int digits m_offset(offset), m_scale(scale), m_flip_pol(flip_polarity), - m_current_aperture(0.0), + m_current_aperture(0.05), m_aperture_set(false), m_macro_aperture(false), m_aperture_num(10) /* See gerber standard */ @@ -63,11 +63,13 @@ void SimpleGerberOutput::header_impl(d2p origin, d2p size) { } SimpleGerberOutput& SimpleGerberOutput::operator<<(const ApertureToken &ap) { - if (m_aperture_set && !m_macro_aperture && ap.m_size == m_current_aperture) { + cerr << ap.m_size << " / " << m_current_aperture << endl; + m_aperture_set = ap.m_has_aperture; + + if (!m_macro_aperture && ap.m_size == m_current_aperture) { return *this; } - m_aperture_set = ap.m_has_aperture; m_macro_aperture = false; if (m_aperture_set) { @@ -78,6 +80,7 @@ SimpleGerberOutput& SimpleGerberOutput::operator<<(const ApertureToken &ap) { m_out << "%ADD" << m_aperture_num << "C," << size << "*%" << endl; m_out << "D" << m_aperture_num << "*" << endl; } + return *this; } -- cgit