Use perimeter extruder for brim. #618

This commit is contained in:
Alessandro Ranellucci 2014-12-17 00:45:05 +01:00
parent e79aa2e81c
commit c00061678b
8 changed files with 39 additions and 11 deletions

View File

@ -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 --extruder-offset Offset of each extruder, if firmware doesn't handle the displacement
(can be specified multiple times, default: 0x0) (can be specified multiple times, default: 0x0)
--perimeter-extruder --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) --infill-extruder Extruder to use for infill (1+, default: 1)
--solid-infill-extruder Extruder to use for solid infill (1+, default: 1) --solid-infill-extruder Extruder to use for solid infill (1+, default: 1)
--support-material-extruder --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 --support-material-interface-extruder
Extruder to use for support material interface (1+, default: 1) Extruder to use for support material interface (1+, default: 1)
--ooze-prevention Drop temperature and park extruders outside a full skirt for automatic wiping --ooze-prevention Drop temperature and park extruders outside a full skirt for automatic wiping

View File

@ -332,9 +332,9 @@ sub make_brim {
} }
$self->status_cb->(88, "Generating 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 $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 $mm3_per_mm = $flow->mm3_per_mm;
my $grow_distance = $flow->scaled_width / 2; my $grow_distance = $flow->scaled_width / 2;

View File

@ -348,7 +348,7 @@ sub process_layer {
# extrude brim # extrude brim
if (!$self->_brim_done) { 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->set_origin(Slic3r::Pointf->new(0,0));
$self->_gcodegen->avoid_crossing_perimeters->use_external_mp(1); $self->_gcodegen->avoid_crossing_perimeters->use_external_mp(1);
$gcode .= $self->_gcodegen->extrude_loop($_, 'brim', $object->config->support_material_speed) $gcode .= $self->_gcodegen->extrude_loop($_, 'brim', $object->config->support_material_speed)

View File

@ -503,11 +503,11 @@ $j
--extruder-offset Offset of each extruder, if firmware doesn't handle the displacement --extruder-offset Offset of each extruder, if firmware doesn't handle the displacement
(can be specified multiple times, default: 0x0) (can be specified multiple times, default: 0x0)
--perimeter-extruder --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}) --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}) --solid-infill-extruder Extruder to use for solid infill (1+, default: $config->{solid_infill_extruder})
--support-material-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 --support-material-interface-extruder
Extruder to use for support material interface (1+, default: $config->{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 --ooze-prevention Drop temperature and park extruders outside a full skirt for automatic wiping

View File

@ -669,11 +669,12 @@ Print::total_bounding_box() const
} }
// consider brim and skirt // consider brim and skirt
Flow skirt_flow = this->skirt_flow();
if (this->config.brim_width.value > 0) { 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) { if (this->config.skirts.value > 0) {
Flow skirt_flow = this->skirt_flow();
extra = std::max( extra = std::max(
extra, extra,
this->config.brim_width.value 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"); 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 Flow
Print::skirt_flow() const Print::skirt_flow() const
{ {
ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width; ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width;
if (width.value == 0) width = this->regions.front()->config.perimeter_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( return Flow::new_from_config_width(
frPerimeter, frPerimeter,
width, width,

View File

@ -188,6 +188,7 @@ class Print
BoundingBox bounding_box() const; BoundingBox bounding_box() const;
BoundingBox total_bounding_box() const; BoundingBox total_bounding_box() const;
double skirt_first_layer_height() const; double skirt_first_layer_height() const;
Flow brim_flow() const;
Flow skirt_flow() const; Flow skirt_flow() const;
std::set<size_t> extruders() const; std::set<size_t> extruders() const;

View File

@ -529,7 +529,7 @@ PrintConfigDef::build_def() {
Options["perimeter_extruder"].type = coInt; Options["perimeter_extruder"].type = coInt;
Options["perimeter_extruder"].label = "Perimeter extruder"; Options["perimeter_extruder"].label = "Perimeter extruder";
Options["perimeter_extruder"].category = "Extruders"; 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"].cli = "perimeter-extruder=i";
Options["perimeter_extruder"].aliases.push_back("perimeters_extruder"); Options["perimeter_extruder"].aliases.push_back("perimeters_extruder");
Options["perimeter_extruder"].min = 1; Options["perimeter_extruder"].min = 1;
@ -781,7 +781,7 @@ PrintConfigDef::build_def() {
Options["support_material_extruder"].type = coInt; Options["support_material_extruder"].type = coInt;
Options["support_material_extruder"].label = "Support material extruder"; Options["support_material_extruder"].label = "Support material extruder";
Options["support_material_extruder"].category = "Extruders"; 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"].cli = "support-material-extruder=i";
Options["support_material_extruder"].min = 1; Options["support_material_extruder"].min = 1;

View File

@ -190,6 +190,7 @@ _constant()
Clone<BoundingBox> bounding_box(); Clone<BoundingBox> bounding_box();
Clone<BoundingBox> total_bounding_box(); Clone<BoundingBox> total_bounding_box();
double skirt_first_layer_height(); double skirt_first_layer_height();
Clone<Flow> brim_flow();
Clone<Flow> skirt_flow(); Clone<Flow> skirt_flow();
%{ %{