diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 537817f52..e4e011960 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -57,7 +57,16 @@ sub slice { # plus the extra distance required by the support material logic my $first_layer_height = $self->config->get_value('first_layer_height'); $print_z += $first_layer_height; - $print_z += $self->config->layer_height * ($self->config->raft_layers - 1); + + # use a large height + my $support_material_layer_height; + { + my @nozzle_diameters = ( + map $self->print->config->get_at('nozzle_diameter', $_), @{$self->print->support_material_extruders} + ); + $support_material_layer_height = 0.75 * min(@nozzle_diameters); + } + $print_z += $support_material_layer_height * ($self->config->raft_layers - 1); # compute the average of all nozzles used for printing the object my $nozzle_diameter; diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 0dab8e70b..6fff54720 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -322,11 +322,10 @@ Print::object_extruders() const // returns 0-based indices of used extruders std::set -Print::extruders() const +Print::support_material_extruders() const { - std::set extruders = this->object_extruders(); + std::set extruders; - // add support material extruder(s) FOREACH_OBJECT(this, object) { if ((*object)->has_support_material()) { extruders.insert((*object)->config.support_material_extruder - 1); @@ -337,6 +336,18 @@ Print::extruders() const return extruders; } +// returns 0-based indices of used extruders +std::set +Print::extruders() const +{ + std::set extruders = this->object_extruders(); + + std::set s_extruders = this->support_material_extruders(); + extruders.insert(s_extruders.begin(), s_extruders.end()); + + return extruders; +} + void Print::_simplify_slices(double distance) { diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index 489eebc08..8252fe2d2 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -199,6 +199,7 @@ class Print Flow skirt_flow() const; std::set object_extruders() const; + std::set support_material_extruders() const; std::set extruders() const; void _simplify_slices(double distance); double max_allowed_layer_height() const; diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp index 1a6635c30..b1396efe0 100644 --- a/xs/xsp/Print.xsp +++ b/xs/xsp/Print.xsp @@ -169,6 +169,14 @@ _constant() RETVAL.push_back(*e); } %}; + std::vector support_material_extruders() + %code%{ + std::set extruders = THIS->support_material_extruders(); + RETVAL.reserve(extruders.size()); + for (std::set::const_iterator e = extruders.begin(); e != extruders.end(); ++e) { + RETVAL.push_back(*e); + } + %}; std::vector extruders() %code%{ std::set extruders = THIS->extruders();