From f1230312e3ee8a3eb5d157f8b6223829e2d56f7c Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 26 Jan 2013 23:55:47 +0100 Subject: [PATCH] Fixes for merge issues --- lib/Slic3r/GCode.pm | 12 +++++------- lib/Slic3r/GCode/MotionPlanner.pm | 2 +- lib/Slic3r/Print.pm | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 35a878ea..9f92b912 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -163,8 +163,7 @@ sub extrude_loop { $point->rotate($angle, $extrusion_path->polyline->[0]); # generate the travel move - $self->speed('travel'); - $gcode .= $self->G0($point, undef, 0, "move inwards before travel"); + $gcode .= $self->travel_to($point, "move inwards before travel"); } return $gcode; @@ -205,9 +204,7 @@ sub extrude_path { } # go to first point of extrusion path - $self->speed('travel'); - $gcode .= $self->G0($path->points->[0], undef, 0, "move to first $description point") - if !points_coincide($self->last_pos, $path->points->[0]); + $gcode .= $self->travel_to($path->points->[0], "move to first $description point"); # compensate retraction $gcode .= $self->unretract; @@ -265,13 +262,14 @@ sub travel_to { my ($point, $comment) = @_; return "" if points_coincide($self->last_pos, $point); - + $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 '', - map $self->G0($_->b, undef, 0, $comment || ""), + map $self->G0($_->[B], undef, 0, $comment || ""), $mp->shortest_path($self->last_pos, $point)->lines; }; diff --git a/lib/Slic3r/GCode/MotionPlanner.pm b/lib/Slic3r/GCode/MotionPlanner.pm index 7bd84b4f..810a02ae 100644 --- a/lib/Slic3r/GCode/MotionPlanner.pm +++ b/lib/Slic3r/GCode/MotionPlanner.pm @@ -169,7 +169,7 @@ sub BUILD { } require "Slic3r/SVG.pm"; - Slic3r::SVG::output(undef, "space.svg", + Slic3r::SVG::output("space.svg", lines => \@lines, points => [ values %{$self->_pointmap} ], no_arrows => 1, diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 0bfdeec0..5f06cf1d 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -794,6 +794,7 @@ sub write_gcode { for my $obj_copy (@$object_copies) { my ($obj_idx, $copy) = @$obj_copy; $gcodegen->new_object(1) if $last_obj_copy && $last_obj_copy ne "${obj_idx}_${copy}"; + $last_obj_copy = "${obj_idx}_${copy}"; my $layer = $self->objects->[$obj_idx]->layers->[$layer_id]; $gcodegen->set_shift(map $shift[$_] + unscale $copy->[$_], X,Y);