mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Merge branch 'master' into sender
This commit is contained in:
		
						commit
						3ab4d4b094
					
				
					 16 changed files with 192 additions and 61 deletions
				
			
		|  | @ -1009,6 +1009,9 @@ sub export_gcode { | |||
|         $self->on_export_completed($result); | ||||
|     } | ||||
|      | ||||
|     # this updates buttons status | ||||
|     $self->object_list_changed; | ||||
|      | ||||
|     return $self->{export_gcode_output_file}; | ||||
| } | ||||
| 
 | ||||
|  | @ -1094,6 +1097,9 @@ sub on_export_completed { | |||
|     $self->send_gcode if $send_gcode; | ||||
|     $self->{print_file} = undef; | ||||
|     $self->{send_gcode_file} = undef; | ||||
|      | ||||
|     # this updates buttons status | ||||
|     $self->object_list_changed; | ||||
| } | ||||
| 
 | ||||
| sub do_print { | ||||
|  | @ -1122,7 +1128,7 @@ sub send_gcode { | |||
|     $self->statusbar->StartBusy; | ||||
|      | ||||
|     my $ua = LWP::UserAgent->new; | ||||
|     $ua->timeout(10); | ||||
|     $ua->timeout(180); | ||||
|      | ||||
|     my $res = $ua->post( | ||||
|         "http://" . $self->{config}->octoprint_host . "/api/files/local", | ||||
|  | @ -1158,6 +1164,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; | ||||
|      | ||||
|  | @ -1405,6 +1424,11 @@ sub object_list_changed { | |||
|     $self->{"btn_$_"}->$method | ||||
|         for grep $self->{"btn_$_"}, qw(reset arrange export_gcode export_stl print send_gcode); | ||||
|      | ||||
|     if ($self->{export_gcode_output_file} || $self->{send_gcode_file}) { | ||||
|         $self->{btn_export_gcode}->Disable; | ||||
|         $self->{btn_send_gcode}->Disable; | ||||
|     } | ||||
|      | ||||
|     if ($self->{htoolbar}) { | ||||
|         $self->{htoolbar}->EnableTool($_, $have_objects) | ||||
|             for (TB_RESET, TB_ARRANGE); | ||||
|  | @ -1584,6 +1608,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…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci