New --extruder-offset option

This commit is contained in:
Alessandro Ranellucci 2012-08-07 21:39:45 +02:00
parent a2c28fd6da
commit 866b09f3f9
6 changed files with 24 additions and 5 deletions

View File

@ -249,6 +249,8 @@ The author of the Silk icon set is Mark James.
--bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: 1)
Multiple extruder options:
--extruder-offset Offset of each extruder, if firmware doesn't handle the displacement
(can be specified multiple times, default: 0x0)
--perimeters-extruder
Extruder to use for perimeters (1+, default: 1)
--infill-extruder Extruder to use for infill (1+, default: 1)

View File

@ -110,6 +110,16 @@ our $Options = {
},
# extruders options
'extruder_offset' => {
label => 'Extruder offset',
tooltip => 'If your firmware doesn\'t handle the extruder displacement you need the G-code to take it into account. This option lets you specify the displacement of each extruder with respect to the first one. It expects positive coordinates (they will be subtracted from the XY coordinate).',
sidetext => 'mm',
cli => 'extruder-offset=s@',
type => 'point',
serialize => sub { join ',', map { join 'x', @$_ } @{$_[0]} },
deserialize => sub { [ map [ split /x/, $_ ], (ref $_[0] eq 'ARRAY') ? @{$_[0]} : (split /,/, $_[0]) ] },
default => [[0,0]],
},
'nozzle_diameter' => {
label => 'Nozzle diameter',
tooltip => 'This is the diameter of your extruder nozzle (for example: 0.5, 0.35 etc.)',
@ -818,7 +828,7 @@ sub new_from_cli {
}
$args{$_} = $Options->{$_}{deserialize}->($args{$_})
for grep exists $args{$_}, qw(print_center bed_size duplicate_grid);
for grep exists $args{$_}, qw(print_center bed_size duplicate_grid extruder_offset);
return $class->new(%args);
}

View File

@ -4,6 +4,7 @@ use Moo;
use Slic3r::Geometry qw(PI);
use constant OPTIONS => [qw(
extruder_offset
nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature
)];
has $_ => (is => 'ro', required => 1) for @{&OPTIONS};

View File

@ -295,8 +295,8 @@ sub _G0_G1 {
if ($point) {
$gcode .= sprintf " X%.${dec}f Y%.${dec}f",
($point->x * &Slic3r::SCALING_FACTOR) + $self->shift_x,
($point->y * &Slic3r::SCALING_FACTOR) + $self->shift_y; #**
($point->x * &Slic3r::SCALING_FACTOR) + $self->shift_x - $self->extruder->extruder_offset->[X],
($point->y * &Slic3r::SCALING_FACTOR) + $self->shift_y - $self->extruder->extruder_offset->[Y]; #**
$self->last_pos($point);
}
if (defined $z && $z != $self->z) {
@ -315,8 +315,8 @@ sub G2_G3 {
my $gcode = $orientation eq 'cw' ? "G2" : "G3";
$gcode .= sprintf " X%.${dec}f Y%.${dec}f",
($point->x * &Slic3r::SCALING_FACTOR) + $self->shift_x,
($point->y * &Slic3r::SCALING_FACTOR) + $self->shift_y; #**
($point->x * &Slic3r::SCALING_FACTOR) + $self->shift_x - $self->extruder->extruder_offset->[X],
($point->y * &Slic3r::SCALING_FACTOR) + $self->shift_y - $self->extruder->extruder_offset->[Y]; #**
# XY distance of the center from the start position
$gcode .= sprintf " I%.${dec}f J%.${dec}f",

View File

@ -611,6 +611,10 @@ sub _build_extruder_pages {
title => 'Size',
options => ['nozzle_diameter#' . $extruder_idx],
},
{
title => 'Position (for multi-extruder printers)',
options => ['extruder_offset#' . $extruder_idx],
},
]);
$self->{extruder_pages}[$extruder_idx]{disabled} = 0;
}

View File

@ -291,6 +291,8 @@ $j
--bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: $config->{bridge_flow_ratio})
Multiple extruder options:
--extruder-offset Offset of each extruder, if firmware doesn't handle the displacement
(can be specified multiple times, default: 0x0)
--perimeters-extruder
Extruder to use for perimeters (1+, default: 1)
--infill-extruder Extruder to use for infill (1+, default: 1)