From cb4ede7f9e8bfa6c1c1b6988cf5992407bd7e423 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 1 Nov 2012 11:34:53 +0100 Subject: [PATCH] Do not pass the Print object to SVG::output anymore --- lib/Slic3r/Fill/PlanePath.pm | 2 +- lib/Slic3r/Layer/Region.pm | 6 +++--- lib/Slic3r/Print/Object.pm | 2 +- lib/Slic3r/SVG.pm | 7 ++----- lib/Slic3r/TriangleMesh.pm | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/Slic3r/Fill/PlanePath.pm b/lib/Slic3r/Fill/PlanePath.pm index d33b6e6f..acc1e331 100644 --- a/lib/Slic3r/Fill/PlanePath.pm +++ b/lib/Slic3r/Fill/PlanePath.pm @@ -51,7 +51,7 @@ sub fill_surface { if (0) { require "Slic3r/SVG.pm"; - Slic3r::SVG::output(undef, "fill.svg", + Slic3r::SVG::output("fill.svg", polygons => $expolygon, polylines => [map $_->p, @paths], ); diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index 9f88dae8..8ce27bf1 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -129,7 +129,7 @@ sub make_surfaces { if (0) { require "Slic3r/SVG.pm"; - Slic3r::SVG::output(undef, "surfaces.svg", + Slic3r::SVG::output("surfaces.svg", polygons => [ map $_->contour, @{$self->slices} ], red_polygons => [ map $_->p, map @{$_->holes}, @{$self->slices} ], ); @@ -462,7 +462,7 @@ sub process_bridges { if (0) { require "Slic3r/SVG.pm"; - Slic3r::SVG::output(undef, "bridge_surfaces.svg", + Slic3r::SVG::output("bridge_surfaces.svg", green_polygons => [ map $_->p, @supporting_surfaces ], red_polygons => [ @$expolygon ], ); @@ -494,7 +494,7 @@ sub process_bridges { if (0) { require "Slic3r/SVG.pm"; - Slic3r::SVG::output(undef, "bridge_edges.svg", + Slic3r::SVG::output("bridge_edges.svg", polylines => [ map $_->p, @edges ], ); } diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index d1e3611d..9c5479f2 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -595,7 +595,7 @@ sub generate_support_material { if (0) { require "Slic3r/SVG.pm"; - Slic3r::SVG::output(undef, "support_$_.svg", + Slic3r::SVG::output("support_$_.svg", polylines => [ map $_->polyline, map @$_, $support_patterns->[$_] ], polygons => [ map @$_, @support_material_areas ], ) for 0 .. $#$support_patterns; diff --git a/lib/Slic3r/SVG.pm b/lib/Slic3r/SVG.pm index 1bfa839f..8621614b 100644 --- a/lib/Slic3r/SVG.pm +++ b/lib/Slic3r/SVG.pm @@ -12,10 +12,7 @@ sub factor { } sub svg { - my ($print) = @_; - $print ||= Slic3r::Print->new(x_length => 200 / &Slic3r::SCALING_FACTOR, y_length => 200 / &Slic3r::SCALING_FACTOR); my $svg = SVG->new(width => 200 * 10, height => 200 * 10); - my $marker_end = $svg->marker( id => "endArrow", viewBox => "0 0 10 10", @@ -35,9 +32,9 @@ sub svg { } sub output { - my ($print, $filename, %things) = @_; + my ($filename, %things) = @_; - my $svg = svg($print); + my $svg = svg(); foreach my $type (qw(polygons polylines white_polygons green_polygons red_polygons red_polylines)) { if ($things{$type}) { diff --git a/lib/Slic3r/TriangleMesh.pm b/lib/Slic3r/TriangleMesh.pm index a677273b..a2a416b5 100644 --- a/lib/Slic3r/TriangleMesh.pm +++ b/lib/Slic3r/TriangleMesh.pm @@ -240,7 +240,7 @@ sub make_loops { Slic3r::debugf " this shouldn't happen and should be further investigated\n"; if (0) { require "Slic3r/SVG.pm"; - Slic3r::SVG::output(undef, "same_point.svg", + Slic3r::SVG::output("same_point.svg", lines => [ map $_->line, grep !defined $_->[I_FACET_EDGE], @lines ], red_lines => [ map $_->line, grep defined $_->[I_FACET_EDGE], @lines ], #points => [ $self->vertices->[$point_id] ],