diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index b895a1d9..1c9bf4b0 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -246,8 +246,25 @@ sub extrude_loop { # get non-overhang paths by subtracting overhangs from the loop push @paths, map $_->clone, - @{$extrusion_path->subtract_expolygons($self->_layer_overhangs)}; + @{$extrusion_path->subtract_expolygons(Slic3r::ExPolygon::Collection->new || $self->_layer_overhangs)}; + if (@paths == 1) { + if ($paths[0]->polyline->length != $extrusion_path->polyline->length) { + use XXX; YYY ( + $extrusion_path->polyline->wkt, + $paths[0]->polyline->wkt, + ); + + use Slic3r::SVG; + Slic3r::SVG::output("path.svg", + red_polylines => [ $extrusion_path->polyline ], + polylines => [ $paths[0]->polyline ], + ); + exit; + } + } + + if (0) { # get overhang paths by intersecting overhangs with the loop foreach my $path (@{$extrusion_path->intersect_expolygons($self->_layer_overhangs)}) { $path = $path->clone; @@ -255,11 +272,12 @@ sub extrude_loop { $path->mm3_per_mm($self->region->flow(FLOW_ROLE_PERIMETER, -1, 1)->mm3_per_mm(-1)); push @paths, $path; } + } # reapply the nearest point search for starting point # (clone because the collection gets DESTROY'ed) my $collection = Slic3r::ExtrusionPath::Collection->new(@paths); - @paths = map $_->clone, @{$collection->chained_path_from($start_at, 1)}; + #@paths = map $_->clone, @{$collection->chained_path_from($start_at, 1)}; } else { push @paths, $extrusion_path; } diff --git a/xs/src/ClipperUtils.cpp b/xs/src/ClipperUtils.cpp index 57216f0b..c28d900d 100644 --- a/xs/src/ClipperUtils.cpp +++ b/xs/src/ClipperUtils.cpp @@ -370,6 +370,8 @@ template void diff(const Slic3r::Polygons &subject, const Slic void diff(const Slic3r::Polylines &subject, const Slic3r::Polygons &clip, Slic3r::Polylines &retval) { _clipper(ClipperLib::ctDifference, subject, clip, retval); + printf("polylines = %zu, polygons = %zu, return polylines = %zu\n", + subject.size(), clip.size(), retval.size()); } template