From 471983d63a19d6be05dc8fe60cbe4aa235a8405d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 12 May 2018 18:57:12 -0500 Subject: [PATCH] Draw skirt on 2D plater. --- src/GUI/Plater/Plate2D.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 15f449c03..685a95495 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -147,6 +147,29 @@ void Plate2D::repaint(wxPaintEvent& e) { } } } + + // Draw skirt + if (this->objects.size() > 0 && this->config->get("skirts") > 0) + { + // get all of the contours of the instances + Slic3r::Polygons tmp_cont {}; + for (auto obj : this->objects) { + for (auto inst : obj.instance_thumbnails) { + tmp_cont.push_back(inst.convex_hull()); + } + } + + // Calculate the offset hull and draw the points. + if (tmp_cont.size() > 0) { + dc->SetPen(this->skirt_pen); + dc->SetBrush(this->transparent_brush); + auto skirt {offset(Slic3r::Geometry::convex_hull(tmp_cont), + scale_(this->config->get("brim_width") + this->config->get("skirt_distance")), 1.0, ClipperLib::jtRound, scale_(0.1))}; + auto poly { this->scaled_points_to_pixel(skirt.front(), true) }; + dc->DrawPolygon(poly.size(), poly.data(), 0, 0); + } + } + e.Skip(); }