Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2016-09-30 16:23:18 +0300
committerbubnikv <bubnikv@gmail.com>2016-09-30 16:23:18 +0300
commit3a81e6bee420196698e3f1409a8a7318dd35965b (patch)
tree70574b85f26c77406691b1ed188049fd201911ee /xs/src/libslic3r/SurfaceCollection.cpp
parentb5e24d3527db0bc9153365b0709787e145aeb982 (diff)
Bugfix of bottom bridges. If close regions shall be closed by bridges,
these regions are grown to anchor the bridge lines to the bottom surface. The grown regions may overlap. In that case the regions are now merged before the bridging direction is calculated for the merged region.
Diffstat (limited to 'xs/src/libslic3r/SurfaceCollection.cpp')
-rw-r--r--xs/src/libslic3r/SurfaceCollection.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/xs/src/libslic3r/SurfaceCollection.cpp b/xs/src/libslic3r/SurfaceCollection.cpp
index 5fbb913b1..c30998df4 100644
--- a/xs/src/libslic3r/SurfaceCollection.cpp
+++ b/xs/src/libslic3r/SurfaceCollection.cpp
@@ -1,4 +1,7 @@
#include "SurfaceCollection.hpp"
+#include "BoundingBox.hpp"
+#include "SVG.hpp"
+
#include <map>
namespace Slic3r {
@@ -213,4 +216,28 @@ SurfaceCollection::append(const SurfaceType surfaceType, const Slic3r::ExPolygon
this->surfaces.push_back(Slic3r::Surface(surfaceType, *it));
}
+void SurfaceCollection::export_to_svg(const char *path, bool show_labels)
+{
+ BoundingBox bbox;
+ for (Surfaces::const_iterator surface = this->surfaces.begin(); surface != this->surfaces.end(); ++surface)
+ bbox.merge(get_extents(surface->expolygon));
+ Point legend_size = export_surface_type_legend_to_svg_box_size();
+ Point legend_pos(bbox.min.x, bbox.max.y);
+ bbox.merge(Point(std::max(bbox.min.x + legend_size.x, bbox.max.x), bbox.max.y + legend_size.y));
+
+ SVG svg(path, bbox);
+ const float transparency = 0.5f;
+ for (Surfaces::const_iterator surface = this->surfaces.begin(); surface != this->surfaces.end(); ++surface) {
+ svg.draw(surface->expolygon, surface_type_to_color_name(surface->surface_type), transparency);
+ if (show_labels) {
+ int idx = int(surface - this->surfaces.cbegin());
+ char label[64];
+ sprintf(label, "%d", idx);
+ svg.draw_text(surface->expolygon.contour.points.front(), label, "black");
+ }
+ }
+ export_surface_type_legend_to_svg(svg, legend_pos);
+ svg.Close();
+}
+
}