diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 42b3a64f5..dc44f4959 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -26,14 +26,22 @@ PrintConfigDef::PrintConfigDef() // Maximum extruder temperature, bumped to 1500 to support printing of glass. const int max_temp = 1500; - def = this->add("avoid_crossing_perimeters", coBool); + def = this->add("avoid_crossing_perimeters", coBool); def->label = L("Avoid crossing perimeters"); - def->tooltip = L("Optimize travel moves in order to minimize the crossing of perimeters. " - "This is mostly useful with Bowden extruders which suffer from oozing. " - "This feature slows down both the print and the G-code generation."); + def->tooltip = L("Optimize travel moves in order to minimize the crossing of perimeters. " + "This is mostly useful with Bowden extruders which suffer from oozing. " + "This feature slows down both the print and the G-code generation."); def->cli = "avoid-crossing-perimeters!"; def->default_value = new ConfigOptionBool(false); + def = this->add("remove_small_gaps", coBool); + def->label = L("Remove small gaps"); + def->tooltip = L("Remove the small gaps in the 3D model when slicing. Disable it if you " + "are very confident on your model, or you want to print an item with a geometry " + "designed for vase mode."); + def->cli = "remove-small-gaps!"; + def->default_value = new ConfigOptionBool(true); + def = this->add("bed_shape", coPoints); def->label = L("Bed shape"); def->default_value = new ConfigOptionPoints { Pointf(0,0), Pointf(200,0), Pointf(200,200), Pointf(0,200) }; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 56314a6e0..658d1b268 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -341,6 +341,7 @@ class PrintObjectConfig : public StaticPrintConfig STATIC_PRINT_CONFIG_CACHE(PrintObjectConfig) public: ConfigOptionBool clip_multipart_objects; + ConfigOptionBool remove_small_gaps; ConfigOptionBool dont_support_bridges; ConfigOptionFloat elefant_foot_compensation; ConfigOptionFloatOrPercent extrusion_width; @@ -388,6 +389,7 @@ protected: void initialize(StaticCacheBase &cache, const char *base_ptr) { OPT_PTR(clip_multipart_objects); + OPT_PTR(remove_small_gaps); OPT_PTR(dont_support_bridges); OPT_PTR(elefant_foot_compensation); OPT_PTR(extrusion_width); diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index e9a4e1e2d..0b17ffec9 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -1856,6 +1856,7 @@ std::vector PrintObject::_slice_volumes(const std::vector &z, mesh.translate(- float(unscale(this->_copies_shift.x)), - float(unscale(this->_copies_shift.y)), -float(this->model_object()->bounding_box().min.z)); // perform actual slicing TriangleMeshSlicer mslicer(&mesh); + mslicer.safety_offset = (this->config.remove_small_gaps ? scale_(0.0499) : SCALED_EPSILON); mslicer.slice(z, &layers); } } diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp index 544a5d00b..b8875d07d 100644 --- a/xs/src/libslic3r/TriangleMesh.cpp +++ b/xs/src/libslic3r/TriangleMesh.cpp @@ -1792,7 +1792,7 @@ void TriangleMeshSlicer::make_expolygons(const Polygons &loops, ExPolygons* slic //} // perform a safety offset to merge very close facets (TODO: find test case for this) - double safety_offset = scale_(0.0499); + //double safety_offset = scale_(0.0499); // now a config value //FIXME see https://github.com/prusa3d/Slic3r/issues/520 // double safety_offset = scale_(0.0001); diff --git a/xs/src/libslic3r/TriangleMesh.hpp b/xs/src/libslic3r/TriangleMesh.hpp index 24e903c0a..dad5b4010 100644 --- a/xs/src/libslic3r/TriangleMesh.hpp +++ b/xs/src/libslic3r/TriangleMesh.hpp @@ -168,6 +168,7 @@ public: const float min_z, const float max_z, IntersectionLine *line_out) const; void cut(float z, TriangleMesh* upper, TriangleMesh* lower) const; + double safety_offset = scale_(0.0499); private: const TriangleMesh *mesh; // Map from a facet to an edge index. diff --git a/xs/src/slic3r/GUI/Preset.cpp b/xs/src/slic3r/GUI/Preset.cpp index d0159dfb8..017e53d29 100644 --- a/xs/src/slic3r/GUI/Preset.cpp +++ b/xs/src/slic3r/GUI/Preset.cpp @@ -308,6 +308,7 @@ const std::vector& Preset::print_options() "only_one_perimeter_top", "single_extruder_multi_material_priming", "compatible_printers", "compatible_printers_condition", "inherits", "infill_dense", "infill_dense_algo", "no_perimeter_unsupported", "min_perimeter_unsupported", "noperi_bridge_only", "support_material_solid_first_layer", "perimeter_loop", "perimeter_loop_seam", "seam_travel" + , "remove_small_gaps" }; return s_opts; } diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp index 3b3d7b0de..6f3cf0da3 100644 --- a/xs/src/slic3r/GUI/Tab.cpp +++ b/xs/src/slic3r/GUI/Tab.cpp @@ -819,7 +819,8 @@ void TabPrint::build() optgroup->append_line(line); optgroup = page->new_optgroup(_(L("Advanced"))); - line = { _(L("Seam options")), "" }; + optgroup->append_single_option_line("remove_small_gaps"); + line = { _(L("Avoid unsupported perimeters")), "" }; line.append_option(optgroup->get_option("seam_position")); line.append_option(optgroup->get_option("seam_travel")); optgroup->append_line(line);