Skip to content

Commit

Permalink
Fix external motionplanner too
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Jan 27, 2013
1 parent f123031 commit ad48fdc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/Slic3r/GCode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ sub set_shift {
my @shift = @_;

$self->last_pos->translate(
scale ($shift[X] - $self->shift_x),
scale ($shift[Y] - $self->shift_y),
scale ($self->shift_x - $shift[X]),
scale ($self->shift_y - $shift[Y]),
);

$self->shift_x($shift[X]);
Expand Down Expand Up @@ -265,7 +265,6 @@ sub travel_to {
$self->speed('travel');
my $gcode = "";
if ($Slic3r::Config->avoid_crossing_perimeters && $self->last_pos->distance_to($point) > scale 5 && !$self->straight_once) {
$point = $point->clone;
my $plan = sub {
my $mp = shift;
return join '',
Expand All @@ -274,11 +273,16 @@ sub travel_to {
};

if ($self->new_object) {
$self->new_object(0);

# represent $point in G-code coordinates
$point = $point->clone;
my @shift = ($self->shift_x, $self->shift_y);
$self->set_shift(0,0);
$point->translate(map scale $_, @shift);

# calculate path (external_mp uses G-code coordinates so we temporary need a null shift)
$self->set_shift(0,0);
$gcode .= $plan->($self->external_mp);
$self->new_object(0);
$self->set_shift(@shift);
} else {
$gcode .= $plan->($self->layer_mp);
Expand Down

0 comments on commit ad48fdc

Please sign in to comment.