diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index 4cd4db706..b873177f3 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -201,10 +201,10 @@ sub _init_menubar { $self->_append_menu_item($self->{plater_menu}, "Export G-code...", 'Export current plate as G-code', sub { $plater->export_gcode; }); - $self->_append_menu_item($self->{plater_menu}, "Export STL...", 'Export current plate as STL', sub { + $self->_append_menu_item($self->{plater_menu}, "Export plate as STL...", 'Export current plate as STL', sub { $plater->export_stl; }); - $self->_append_menu_item($self->{plater_menu}, "Export AMF...", 'Export current plate as AMF', sub { + $self->_append_menu_item($self->{plater_menu}, "Export plate as AMF...", 'Export current plate as AMF', sub { $plater->export_amf; }); diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 2517cd893..82b46adcf 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1124,6 +1124,19 @@ sub export_stl { Slic3r::thread_cleanup() if $Slic3r::have_threads; } +sub export_object_stl { + my $self = shift; + + my ($obj_idx, $object) = $self->selected_object; + return if !defined $obj_idx; + + my $model_object = $self->{model}->objects->[$obj_idx]; + + my $output_file = $self->_get_export_file('STL') or return; + Slic3r::Format::STL->write_file($output_file, $model_object->mesh, binary => 1); + $self->statusbar->SetStatusText("STL file exported to $output_file"); +} + sub export_amf { my $self = shift; @@ -1543,6 +1556,10 @@ sub object_menu { $frame->_append_menu_item($menu, "Settings…", 'Open the object editor dialog', sub { $self->object_settings_dialog; }); + $menu->AppendSeparator(); + $frame->_append_menu_item($menu, "Export object as STL…", 'Export this single object as STL file', sub { + $self->export_object_stl; + }); return $menu; }