diff --git a/README.md b/README.md index fe8c267d6..653e40246 100644 --- a/README.md +++ b/README.md @@ -351,11 +351,11 @@ The author of the Silk icon set is Mark James. --extruder-offset Offset of each extruder, if firmware doesn't handle the displacement (can be specified multiple times, default: 0x0) --perimeter-extruder - Extruder to use for perimeters (1+, default: 1) + Extruder to use for perimeters and brim (1+, default: 1) --infill-extruder Extruder to use for infill (1+, default: 1) --solid-infill-extruder Extruder to use for solid infill (1+, default: 1) --support-material-extruder - Extruder to use for support material (1+, default: 1) + Extruder to use for support material, raft and skirt (1+, default: 1) --support-material-interface-extruder Extruder to use for support material interface (1+, default: 1) --ooze-prevention Drop temperature and park extruders outside a full skirt for automatic wiping diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index db7309591..69df1c900 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -332,9 +332,9 @@ sub make_brim { } $self->status_cb->(88, "Generating brim"); - # brim is only printed on first layer and uses support material extruder + # brim is only printed on first layer and uses perimeter extruder my $first_layer_height = $self->skirt_first_layer_height; - my $flow = $self->skirt_flow; + my $flow = $self->brim_flow; my $mm3_per_mm = $flow->mm3_per_mm; my $grow_distance = $flow->scaled_width / 2; diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 7417c48ec..daa665bfd 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -348,7 +348,7 @@ sub process_layer { # extrude brim if (!$self->_brim_done) { - $gcode .= $self->_gcodegen->set_extruder($self->print->objects->[0]->config->support_material_extruder-1); + $gcode .= $self->_gcodegen->set_extruder($self->print->regions->[0]->config->perimeter_extruder-1); $self->_gcodegen->set_origin(Slic3r::Pointf->new(0,0)); $self->_gcodegen->avoid_crossing_perimeters->use_external_mp(1); $gcode .= $self->_gcodegen->extrude_loop($_, 'brim', $object->config->support_material_speed) diff --git a/slic3r.pl b/slic3r.pl index 3568f92e3..debc5ff79 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -503,11 +503,11 @@ $j --extruder-offset Offset of each extruder, if firmware doesn't handle the displacement (can be specified multiple times, default: 0x0) --perimeter-extruder - Extruder to use for perimeters (1+, default: $config->{perimeter_extruder}) + Extruder to use for perimeters and brim (1+, default: $config->{perimeter_extruder}) --infill-extruder Extruder to use for infill (1+, default: $config->{infill_extruder}) --solid-infill-extruder Extruder to use for solid infill (1+, default: $config->{solid_infill_extruder}) --support-material-extruder - Extruder to use for support material (1+, default: $config->{support_material_extruder}) + Extruder to use for support material, raft and skirt (1+, default: $config->{support_material_extruder}) --support-material-interface-extruder Extruder to use for support material interface (1+, default: $config->{support_material_interface_extruder}) --ooze-prevention Drop temperature and park extruders outside a full skirt for automatic wiping diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 9d834c605..1d186d3ab 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -669,11 +669,12 @@ Print::total_bounding_box() const } // consider brim and skirt - Flow skirt_flow = this->skirt_flow(); if (this->config.brim_width.value > 0) { - extra = std::max(extra, this->config.brim_width.value + skirt_flow.width/2); + Flow brim_flow = this->brim_flow(); + extra = std::max(extra, this->config.brim_width.value + brim_flow.width/2); } if (this->config.skirts.value > 0) { + Flow skirt_flow = this->skirt_flow(); extra = std::max( extra, this->config.brim_width.value @@ -696,12 +697,37 @@ Print::skirt_first_layer_height() const return this->objects.front()->config.get_abs_value("first_layer_height"); } +Flow +Print::brim_flow() const +{ + ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width; + if (width.value == 0) width = this->regions.front()->config.perimeter_extrusion_width; + + /* We currently use a random region's perimeter extruder. + While this works for most cases, we should probably consider all of the perimeter + extruders and take the one with, say, the smallest index. + The same logic should be applied to the code that selects the extruder during G-code + generation as well. */ + return Flow::new_from_config_width( + frPerimeter, + width, + this->config.nozzle_diameter.get_at(this->regions.front()->config.perimeter_extruder-1), + this->skirt_first_layer_height(), + 0 + ); +} + Flow Print::skirt_flow() const { ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width; if (width.value == 0) width = this->regions.front()->config.perimeter_extrusion_width; + /* We currently use a random object's support material extruder. + While this works for most cases, we should probably consider all of the support material + extruders and take the one with, say, the smallest index; + The same logic should be applied to the code that selects the extruder during G-code + generation as well. */ return Flow::new_from_config_width( frPerimeter, width, diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index fd0e6a19d..de93385f6 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -188,6 +188,7 @@ class Print BoundingBox bounding_box() const; BoundingBox total_bounding_box() const; double skirt_first_layer_height() const; + Flow brim_flow() const; Flow skirt_flow() const; std::set extruders() const; diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 649c941e9..c0ebb9bd5 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -529,7 +529,7 @@ PrintConfigDef::build_def() { Options["perimeter_extruder"].type = coInt; Options["perimeter_extruder"].label = "Perimeter extruder"; Options["perimeter_extruder"].category = "Extruders"; - Options["perimeter_extruder"].tooltip = "The extruder to use when printing perimeters. First extruder is 1."; + Options["perimeter_extruder"].tooltip = "The extruder to use when printing perimeters and brim. First extruder is 1."; Options["perimeter_extruder"].cli = "perimeter-extruder=i"; Options["perimeter_extruder"].aliases.push_back("perimeters_extruder"); Options["perimeter_extruder"].min = 1; @@ -781,7 +781,7 @@ PrintConfigDef::build_def() { Options["support_material_extruder"].type = coInt; Options["support_material_extruder"].label = "Support material extruder"; Options["support_material_extruder"].category = "Extruders"; - Options["support_material_extruder"].tooltip = "The extruder to use when printing support material. This affects brim and raft too."; + Options["support_material_extruder"].tooltip = "The extruder to use when printing support material, raft and skirt."; Options["support_material_extruder"].cli = "support-material-extruder=i"; Options["support_material_extruder"].min = 1; diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp index aed6f6e4e..baf0a59ed 100644 --- a/xs/xsp/Print.xsp +++ b/xs/xsp/Print.xsp @@ -190,6 +190,7 @@ _constant() Clone bounding_box(); Clone total_bounding_box(); double skirt_first_layer_height(); + Clone brim_flow(); Clone skirt_flow(); %{