mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00:00
New --extruder-offset option
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user