From e845888580eff25332a4f75fc2503089a8835963 Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 24 Jun 2022 13:04:25 +0200 Subject: svg-flatten: Fix pattern aperture macro export --- svg-flatten/src/out_gerber.cpp | 5 ++++- svg-flatten/src/svg_doc.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'svg-flatten') diff --git a/svg-flatten/src/out_gerber.cpp b/svg-flatten/src/out_gerber.cpp index f781649..30518b1 100644 --- a/svg-flatten/src/out_gerber.cpp +++ b/svg-flatten/src/out_gerber.cpp @@ -156,7 +156,10 @@ SimpleGerberOutput &SimpleGerberOutput::operator<<(const PatternToken &tok) { for (auto &pt : pair.first) { m_out << "," << pt[0] << "," << pt[1]; } - m_out << "," << pair.first.back()[0] << "," << pair.first.back()[1] << "*" << endl; + /* We internally represent closed polys as (a - b - c - d), while Gerber aperture macros require the first and + * last vertex to be the same as in (a - b - c - d - a). + */ + m_out << "," << pair.first[0][0] << "," << pair.first[0][1] << "*" << endl; } m_out << "%" << endl; diff --git a/svg-flatten/src/svg_doc.cpp b/svg-flatten/src/svg_doc.cpp index 3d02741..de56fa1 100644 --- a/svg-flatten/src/svg_doc.cpp +++ b/svg-flatten/src/svg_doc.cpp @@ -622,7 +622,7 @@ gerbolyze::RenderContext::RenderContext(RenderContext &parent, PolygonSink &sink m_settings(parent.settings()), m_mat(parent.mat()), m_root(false), - m_included(false), + m_included(true), m_sel(parent.sel()), m_clip(clip) { -- cgit