aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-03-29 15:54:00 +0200
committerjaseg <git@jaseg.de>2023-03-29 15:54:00 +0200
commit454d587d795aef529c04d6c250219ed288f02228 (patch)
treea52159e2c30704ef7e52d93a237942cea00fbb6d
parent602e51ca104381990e0bf9b90e0afc4bf8b86801 (diff)
downloadgerbolyze-454d587d795aef529c04d6c250219ed288f02228.tar.gz
gerbolyze-454d587d795aef529c04d6c250219ed288f02228.tar.bz2
gerbolyze-454d587d795aef529c04d6c250219ed288f02228.zip
svg-flatten: Optimize output aperture count
-rw-r--r--svg-flatten/src/out_gerber.cpp9
1 files changed, 6 insertions, 3 deletions
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;
}