diff options
author | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2022-06-18 17:29:27 +0200 |
---|---|---|
committer | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2022-06-18 17:29:27 +0200 |
commit | 14e9d7fbc2a935ec9c2e6eb9d68e8d250f9614d4 (patch) | |
tree | 9f86768b8ffc04a39db9b614aa4cc11956dda29b /svg-flatten/src/out_gerber.cpp | |
parent | 1622e9c9435d263c3c275718947b1030ad9b6b48 (diff) | |
download | gerbolyze-14e9d7fbc2a935ec9c2e6eb9d68e8d250f9614d4.tar.gz gerbolyze-14e9d7fbc2a935ec9c2e6eb9d68e8d250f9614d4.tar.bz2 gerbolyze-14e9d7fbc2a935ec9c2e6eb9d68e8d250f9614d4.zip |
svg-flatten: add drill handling to outline mode
Diffstat (limited to 'svg-flatten/src/out_gerber.cpp')
-rw-r--r-- | svg-flatten/src/out_gerber.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/svg-flatten/src/out_gerber.cpp b/svg-flatten/src/out_gerber.cpp index b1c5875..c43d07d 100644 --- a/svg-flatten/src/out_gerber.cpp +++ b/svg-flatten/src/out_gerber.cpp @@ -65,6 +65,7 @@ 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; @@ -123,6 +124,17 @@ SimpleGerberOutput& SimpleGerberOutput::operator<<(const Polygon &poly) { return *this; } +SimpleGerberOutput &SimpleGerberOutput::operator<<(const DrillToken &tok) { + double x = round((tok.m_center[0] * m_scale + m_offset[0]) * m_gerber_scale); + double y = round((m_height - tok.m_center[1] * m_scale + m_offset[1]) * m_gerber_scale); + + m_out << "X" << setw(m_digits_int + m_digits_frac) << setfill('0') << std::internal /* isn't C++ a marvel of engineering? */ << (long long int)x + << "Y" << setw(m_digits_int + m_digits_frac) << setfill('0') << std::internal << (long long int)y + << "D03*" << endl; + + return *this; +} + void SimpleGerberOutput::footer_impl() { m_out << "M02*" << endl; } |