new option: Overlapping perimeters, for when you don't care and don't want to use MedialAxis algo

#116
This commit is contained in:
supermerill 2019-11-12 20:13:03 +01:00
parent 9c6008e5e0
commit 351d7d437a
7 changed files with 27 additions and 13 deletions

View File

@ -137,6 +137,7 @@ void Layer::make_perimeters()
&& config.opt_serialize("external_perimeter_extrusion_width").compare(other_config.opt_serialize("external_perimeter_extrusion_width")) == 0
&& config.thin_walls == other_config.thin_walls
&& config.thin_walls_min_width == other_config.thin_walls_min_width
&& config.thin_perimeters == other_config.thin_perimeters
&& config.thin_walls_overlap == other_config.thin_walls_overlap
&& config.external_perimeters_first == other_config.external_perimeters_first
&& config.infill_overlap == other_config.infill_overlap

View File

@ -351,22 +351,21 @@ void PerimeterGenerator::process()
//this variable stored the next onion
ExPolygons next_onion;
if (i == 0) {
// compute next onion, without taking care of thin_walls : destroy too thin areas.
if (!this->config->thin_walls)
next_onion = offset2_ex(
last,
-(float)(ext_perimeter_width / 2 + ext_min_spacing / 2 - 1),
+(float)(ext_min_spacing / 2 - 1));
// look for thin walls
if (this->config->thin_walls) {
// compute next onion
// the minimum thickness of a single loop is:
// ext_width/2 + ext_spacing/2 + spacing/2 + width/2
if (this->config->thin_perimeters)
next_onion = offset_ex(
last,
-(float)(ext_perimeter_width / 2));
else
next_onion = offset2_ex(
last,
-(float)(ext_perimeter_width / 2 + ext_min_spacing / 2 - 1),
+(float)(ext_min_spacing / 2 - 1));
// look for thin walls
if (this->config->thin_walls) {
// detect edge case where a curve can be split in multiple small chunks.
ExPolygons no_thin_onion = offset_ex(last, double( - ext_perimeter_width / 2));
float div = 2;

View File

@ -2811,13 +2811,21 @@ void PrintConfigDef::init_fff_params()
def->max = max_temp;
def->set_default_value(new ConfigOptionInts { 200 });
def = this->add("thin_perimeters", coBool);
def->label = L("Overlapping perimeters");
def->full_label = L("Overlapping perimeters");
def->category = OptionCategory::perimeter;
def->tooltip = L("Allow external perimeter to overlap each other to avoid the use of thin walls. Note that their flow isn't adjusted and so it will result in over-extruding and undefined behavior.");
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("thin_walls", coBool);
def->label = L("");
def->full_label = L("Thin walls");
def->category = OptionCategory::perimeter;
def->tooltip = L("Detect single-width walls (parts where two extrusions don't fit and we need "
"to collapse them into a single trace). If unchecked, slic3r may try to fit perimeters "
"where it's not possible, creating some overlap leading to over-extrusion.");
"to collapse them into a single trace). If unchecked, slic3r may try to fit perimeters "
"where it's not possible, creating some overlap leading to over-extrusion.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));

View File

@ -629,6 +629,7 @@ public:
ConfigOptionInt solid_infill_every_layers;
ConfigOptionFloatOrPercent solid_infill_speed;
// Detect thin walls.
ConfigOptionBool thin_perimeters;
ConfigOptionBool thin_walls;
ConfigOptionFloatOrPercent thin_walls_min_width;
ConfigOptionFloatOrPercent thin_walls_overlap;
@ -696,6 +697,7 @@ protected:
OPT_PTR(solid_infill_extrusion_width);
OPT_PTR(solid_infill_every_layers);
OPT_PTR(solid_infill_speed);
OPT_PTR(thin_perimeters);
OPT_PTR(thin_walls);
OPT_PTR(thin_walls_min_width);
OPT_PTR(thin_walls_overlap);

View File

@ -595,6 +595,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|| opt_key == "first_layer_extrusion_width"
|| opt_key == "perimeter_extrusion_width"
|| opt_key == "infill_overlap"
|| opt_key == "thin_perimeters"
|| opt_key == "thin_walls"
|| opt_key == "thin_walls_min_width"
|| opt_key == "thin_walls_overlap"

View File

@ -381,7 +381,9 @@ const std::vector<std::string>& Preset::print_options()
"layer_height", "first_layer_height", "perimeters", "spiral_vase", "slice_closing_radius", "top_solid_layers", "bottom_solid_layers",
"extra_perimeters",
"extra_perimeters_odd_layers",
"only_one_perimeter_top", "ensure_vertical_shell_thickness", "avoid_crossing_perimeters", "thin_walls", "overhangs",
"only_one_perimeter_top", "ensure_vertical_shell_thickness", "avoid_crossing_perimeters",
"thin_perimeters",
"thin_walls", "overhangs",
"overhangs_width",
"seam_position",
"external_perimeters_first",

View File

@ -1058,6 +1058,7 @@ void TabPrint::build()
optgroup->append_single_option_line("only_one_perimeter_top");
optgroup->append_single_option_line("ensure_vertical_shell_thickness");
optgroup->append_single_option_line("avoid_crossing_perimeters");
optgroup->append_single_option_line("thin_perimeters");
line = { _(L("Thin walls")), "" };
line.append_option(optgroup->get_option("thin_walls"));
line.append_option(optgroup->get_option("thin_walls_min_width"));