option for Slic3r/issues/1364 : use a lower safety offset when slicing the geometry.

This commit is contained in:
supermerill 2018-11-27 19:47:02 +01:00
parent 866bb8b811
commit f3f9b2ce67
7 changed files with 20 additions and 6 deletions

View File

@ -26,14 +26,22 @@ PrintConfigDef::PrintConfigDef()
// Maximum extruder temperature, bumped to 1500 to support printing of glass. // Maximum extruder temperature, bumped to 1500 to support printing of glass.
const int max_temp = 1500; 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->label = L("Avoid crossing perimeters");
def->tooltip = L("Optimize travel moves in order to minimize the crossing of 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 is mostly useful with Bowden extruders which suffer from oozing. "
"This feature slows down both the print and the G-code generation."); "This feature slows down both the print and the G-code generation.");
def->cli = "avoid-crossing-perimeters!"; def->cli = "avoid-crossing-perimeters!";
def->default_value = new ConfigOptionBool(false); 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 = this->add("bed_shape", coPoints);
def->label = L("Bed shape"); def->label = L("Bed shape");
def->default_value = new ConfigOptionPoints { Pointf(0,0), Pointf(200,0), Pointf(200,200), Pointf(0,200) }; def->default_value = new ConfigOptionPoints { Pointf(0,0), Pointf(200,0), Pointf(200,200), Pointf(0,200) };

View File

@ -341,6 +341,7 @@ class PrintObjectConfig : public StaticPrintConfig
STATIC_PRINT_CONFIG_CACHE(PrintObjectConfig) STATIC_PRINT_CONFIG_CACHE(PrintObjectConfig)
public: public:
ConfigOptionBool clip_multipart_objects; ConfigOptionBool clip_multipart_objects;
ConfigOptionBool remove_small_gaps;
ConfigOptionBool dont_support_bridges; ConfigOptionBool dont_support_bridges;
ConfigOptionFloat elefant_foot_compensation; ConfigOptionFloat elefant_foot_compensation;
ConfigOptionFloatOrPercent extrusion_width; ConfigOptionFloatOrPercent extrusion_width;
@ -388,6 +389,7 @@ protected:
void initialize(StaticCacheBase &cache, const char *base_ptr) void initialize(StaticCacheBase &cache, const char *base_ptr)
{ {
OPT_PTR(clip_multipart_objects); OPT_PTR(clip_multipart_objects);
OPT_PTR(remove_small_gaps);
OPT_PTR(dont_support_bridges); OPT_PTR(dont_support_bridges);
OPT_PTR(elefant_foot_compensation); OPT_PTR(elefant_foot_compensation);
OPT_PTR(extrusion_width); OPT_PTR(extrusion_width);

View File

@ -1856,6 +1856,7 @@ std::vector<ExPolygons> PrintObject::_slice_volumes(const std::vector<float> &z,
mesh.translate(- float(unscale(this->_copies_shift.x)), - float(unscale(this->_copies_shift.y)), -float(this->model_object()->bounding_box().min.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 // perform actual slicing
TriangleMeshSlicer mslicer(&mesh); TriangleMeshSlicer mslicer(&mesh);
mslicer.safety_offset = (this->config.remove_small_gaps ? scale_(0.0499) : SCALED_EPSILON);
mslicer.slice(z, &layers); mslicer.slice(z, &layers);
} }
} }

View File

@ -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) // 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 //FIXME see https://github.com/prusa3d/Slic3r/issues/520
// double safety_offset = scale_(0.0001); // double safety_offset = scale_(0.0001);

View File

@ -168,6 +168,7 @@ public:
const float min_z, const float max_z, IntersectionLine *line_out) const; const float min_z, const float max_z, IntersectionLine *line_out) const;
void cut(float z, TriangleMesh* upper, TriangleMesh* lower) const; void cut(float z, TriangleMesh* upper, TriangleMesh* lower) const;
double safety_offset = scale_(0.0499);
private: private:
const TriangleMesh *mesh; const TriangleMesh *mesh;
// Map from a facet to an edge index. // Map from a facet to an edge index.

View File

@ -308,6 +308,7 @@ const std::vector<std::string>& Preset::print_options()
"only_one_perimeter_top", "single_extruder_multi_material_priming", "compatible_printers", "compatible_printers_condition", "inherits", "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", "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" "support_material_solid_first_layer", "perimeter_loop", "perimeter_loop_seam", "seam_travel"
, "remove_small_gaps"
}; };
return s_opts; return s_opts;
} }

View File

@ -819,7 +819,8 @@ void TabPrint::build()
optgroup->append_line(line); optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Advanced"))); 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_position"));
line.append_option(optgroup->get_option("seam_travel")); line.append_option(optgroup->get_option("seam_travel"));
optgroup->append_line(line); optgroup->append_line(line);