Export single object as STL from its contextual menu. #2479
This commit is contained in:
parent
d46d9079a3
commit
3b09377a43
@ -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;
|
||||
});
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user