From 47cc9687a0c883adf36570eb9c9c043e2d69c33b Mon Sep 17 00:00:00 2001 From: bubnikv Date: Sun, 16 Oct 2016 22:11:19 +0200 Subject: [PATCH] Added a new switch: ensure_vertical_shell_thickness This enables a zig-zag infill similar to Cura or Simplify3D on overhangs. --- README.md | 1 + lib/Slic3r/Fill.pm | 11 ++++++++--- lib/Slic3r/GUI/Tab.pm | 5 +++-- slic3r.pl | 1 + xs/src/libslic3r/PrintConfig.cpp | 7 +++++++ xs/src/libslic3r/PrintConfig.hpp | 2 ++ xs/src/libslic3r/PrintObject.cpp | 5 ++++- xs/src/libslic3r/SupportMaterial.hpp | 4 ++++ 8 files changed, 30 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d63e90e3f..078edec75 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,7 @@ The author of the Silk icon set is Mark James. Quality options (slower slicing): --extra-perimeters Add more perimeters when needed (default: yes) + --ensure_vertical_shell_thickness Add solid infill near sloping surfaces to guarantee the vertical shell thickness (top+bottom solid layers). (default: no) --avoid-crossing-perimeters Optimize travel moves so that no perimeters are crossed (default: no) --thin-walls Detect single-width walls (default: yes) --overhangs Experimental option to use bridge flow, speed and fan for overhangs diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm index 6ce7c670a..4e500d275 100644 --- a/lib/Slic3r/Fill.pm +++ b/lib/Slic3r/Fill.pm @@ -229,9 +229,9 @@ sub make_fill { ); $f->spacing($internal_flow->spacing); $using_internal_flow = 1; - } elsif ($surface->surface_type == S_TYPE_INTERNALBRIDGE) { - # The internal bridging layer will be sparse. - $f->spacing($flow->spacing * 2.); +# } elsif ($surface->surface_type == S_TYPE_INTERNALBRIDGE) { +# # The internal bridging layer will be sparse. +# $f->spacing($flow->spacing * 2.); } else { $f->spacing($flow->spacing); } @@ -248,6 +248,11 @@ sub make_fill { $_, density => $density/100, layer_height => $h, +#FIXME Vojtech disabled the automatic extrusion width adjustment as this feature quite often +# generated extrusions with excessive widths. +# The goal of the automatic line width adjustment was to fill in a region without a gap, but because +# the filled regions are mostly not aligned with the fill direction, very likely +# the extrusion width adjustment causes more harm than good. dont_adjust => 1, ), @{ $surface->offset(-scale($f->spacing)/2) }; diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index ec7f35c19..34fb2dabe 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -461,7 +461,7 @@ sub build { layer_height first_layer_height perimeters spiral_vase top_solid_layers bottom_solid_layers - extra_perimeters avoid_crossing_perimeters thin_walls overhangs + extra_perimeters ensure_vertical_shell_thickness avoid_crossing_perimeters thin_walls overhangs seam_position external_perimeters_first fill_density fill_pattern external_fill_pattern infill_every_layers infill_only_where_needed @@ -523,6 +523,7 @@ sub build { { my $optgroup = $page->new_optgroup('Quality (slower slicing)'); $optgroup->append_single_option_line('extra_perimeters'); + $optgroup->append_single_option_line('ensure_vertical_shell_thickness'); $optgroup->append_single_option_line('avoid_crossing_perimeters'); $optgroup->append_single_option_line('thin_walls'); $optgroup->append_single_option_line('overhangs'); @@ -787,7 +788,7 @@ sub _update { my $have_perimeters = $config->perimeters > 0; $self->get_field($_)->toggle($have_perimeters) - for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first + for qw(extra_perimeters ensure_vertical_shell_thickness thin_walls overhangs seam_position external_perimeters_first external_perimeter_extrusion_width perimeter_speed small_perimeter_speed external_perimeter_speed); diff --git a/slic3r.pl b/slic3r.pl index 408ae4cb8..f320c3ab2 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -406,6 +406,7 @@ $j Quality options (slower slicing): --extra-perimeters Add more perimeters when needed (default: yes) + --ensure-vertical-shell-thickness Add solid infill near sloping surfaces to guarantee the vertical shell thickness (top+bottom solid layers). (default: no) --avoid-crossing-perimeters Optimize travel moves so that no perimeters are crossed (default: no) --thin-walls Detect single-width walls (default: yes) --overhangs Experimental option to use bridge flow, speed and fan for overhangs diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 90dfbff62..1e05380e9 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -149,6 +149,13 @@ PrintConfigDef::PrintConfigDef() def->height = 120; def->default_value = new ConfigOptionString("M104 S0 ; turn off temperature\nG28 X0 ; home X axis\nM84 ; disable motors\n"); + def = this->add("ensure_vertical_shell_thickness", coBool); + def->label = "Ensure vertical shell thickness"; + def->category = "Layers and Perimeters"; + def->tooltip = "Add solid infill near sloping surfaces to guarantee the vertical shell thickness (top+bottom solid layers)."; + def->cli = "ensure-vertical-shell-thickness!"; + def->default_value = new ConfigOptionBool(false); + def = this->add("external_fill_pattern", coEnum); def->label = "Top/bottom fill pattern"; def->category = "Infill"; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 08d81eab4..b7cd3a995 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -206,6 +206,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig ConfigOptionInt bottom_solid_layers; ConfigOptionFloat bridge_flow_ratio; ConfigOptionFloat bridge_speed; + ConfigOptionBool ensure_vertical_shell_thickness; ConfigOptionEnum external_fill_pattern; ConfigOptionFloatOrPercent external_perimeter_extrusion_width; ConfigOptionFloatOrPercent external_perimeter_speed; @@ -245,6 +246,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig OPT_PTR(bottom_solid_layers); OPT_PTR(bridge_flow_ratio); OPT_PTR(bridge_speed); + OPT_PTR(ensure_vertical_shell_thickness); OPT_PTR(external_fill_pattern); OPT_PTR(external_perimeter_extrusion_width); OPT_PTR(external_perimeter_speed); diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index ac477f4d7..60bd77bc8 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -247,7 +247,8 @@ PrintObject::invalidate_state_by_config_options(const std::vector_print->regions.size(); ++ idx_region) { + if (! this->_print->regions[idx_region]->config.ensure_vertical_shell_thickness.value) + continue; for (size_t idx_layer = 0; idx_layer < this->layers.size(); ++ idx_layer) { Layer* layer = this->layers[idx_layer]; LayerRegion* layerm = layer->get_region(idx_region); diff --git a/xs/src/libslic3r/SupportMaterial.hpp b/xs/src/libslic3r/SupportMaterial.hpp index d05bf31bf..f784124a6 100644 --- a/xs/src/libslic3r/SupportMaterial.hpp +++ b/xs/src/libslic3r/SupportMaterial.hpp @@ -1,9 +1,13 @@ #ifndef slic3r_SupportMaterial_hpp_ #define slic3r_SupportMaterial_hpp_ +#include "Flow.hpp" + namespace Slic3r { class PrintObject; +class PrintConfig; +class PrintObjectConfig; // how much we extend support around the actual contact area #define SUPPORT_MATERIAL_MARGIN 1.5