From 8aa20cd784274906155dadc40dfddfa8a212a81f Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 30 May 2012 12:06:01 +0200 Subject: [PATCH] Fixed the "Export SVG..." menu item. #399 --- lib/Slic3r/GUI/SkeinPanel.pm | 9 +++++---- lib/Slic3r/Print.pm | 5 +---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index a04740f95..4ffedbe6b 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -169,6 +169,7 @@ sub new { our $model_wildcard = "STL files (*.stl)|*.stl;*.STL|OBJ files (*.obj)|*.obj;*.OBJ|AMF files (*.amf)|*.amf;*.AMF;*.xml;*.XML"; our $ini_wildcard = "INI files *.ini|*.ini;*.INI"; our $gcode_wildcard = "G-code files *.gcode|*.gcode;*.GCODE"; +our $svg_wildcard = "SVG files *.svg|*.svg;*.SVG"; sub do_slice { my $self = shift; @@ -229,7 +230,7 @@ sub do_slice { $output_file = $print->expanded_output_filepath($output_file); $output_file =~ s/\.gcode$/.svg/i if $params{export_svg}; my $dlg = Wx::FileDialog->new($self, 'Save ' . ($params{export_svg} ? 'SVG' : 'G-code') . ' file as:', dirname($output_file), - basename($output_file), $gcode_wildcard, wxFD_SAVE); + basename($output_file), $params{export_svg} ? $svg_wildcard : $gcode_wildcard, wxFD_SAVE); if ($dlg->ShowModal != wxID_OK) { $dlg->Destroy; return; @@ -246,7 +247,7 @@ sub do_slice { { my @warnings = (); local $SIG{__WARN__} = sub { push @warnings, $_[0] }; - my %params = ( + my %export_params = ( output_file => $output_file, status_cb => sub { my ($percent, $message) = @_; @@ -256,9 +257,9 @@ sub do_slice { }, ); if ($params{export_svg}) { - $print->export_svg(%params); + $print->export_svg(%export_params); } else { - $print->export_gcode(%params); + $print->export_gcode(%export_params); } Slic3r::GUI::warning_catcher($self)->($_) for @warnings; } diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index e6ef12db1..981014527 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -332,10 +332,7 @@ sub export_svg { my $self = shift; my %params = @_; - $_->slice for @{$self->objects}; - unless ($params{keep_meshes}) { - $_->mesh(undef) for @{$self->objects}; # free memory - } + $_->slice(keep_meshes => $params{keep_meshes}) for @{$self->objects}; $self->arrange_objects; my $output_file = $self->expanded_output_filepath($params{output_file});