mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 04:02:52 -06:00 
			
		
		
		
	New option for rotating the lower part resulting from the cut so that the flat surface lies on the print bed
This commit is contained in:
		
							parent
							
								
									4f17c2b7d1
								
							
						
					
					
						commit
						8db4913b04
					
				
					 5 changed files with 59 additions and 10 deletions
				
			
		|  | @ -3,6 +3,7 @@ use strict; | |||
| use warnings; | ||||
| use utf8; | ||||
| 
 | ||||
| use Slic3r::Geometry qw(PI); | ||||
| use Wx qw(:dialog :id :misc :sizer wxTAB_TRAVERSAL); | ||||
| use Wx::Event qw(EVT_CLOSE EVT_BUTTON); | ||||
| use base 'Wx::Dialog'; | ||||
|  | @ -17,9 +18,10 @@ sub new { | |||
|      | ||||
|     # cut options | ||||
|     $self->{cut_options} = { | ||||
|         z           => 0, | ||||
|         keep_upper  => 1, | ||||
|         keep_lower  => 1, | ||||
|         z               => 0, | ||||
|         keep_upper      => 1, | ||||
|         keep_lower      => 1, | ||||
|         rotate_lower    => 1, | ||||
|     }; | ||||
|     my $cut_button_sizer = Wx::BoxSizer->new(wxVERTICAL); | ||||
|     { | ||||
|  | @ -48,6 +50,13 @@ sub new { | |||
|                 label       => 'Lower part', | ||||
|                 default     => $self->{cut_options}{keep_lower}, | ||||
|             }, | ||||
|             { | ||||
|                 opt_key     => 'rotate_lower', | ||||
|                 type        => 'bool', | ||||
|                 label       => '', | ||||
|                 tooltip     => 'If enabled, the lower part will be rotated by 180° so that the flat cut surface lies on the print bed.', | ||||
|                 default     => $self->{cut_options}{rotate_lower}, | ||||
|             }, | ||||
|         ], | ||||
|         lines => [ | ||||
|             { | ||||
|  | @ -58,6 +67,10 @@ sub new { | |||
|                 label       => 'Keep', | ||||
|                 options     => [qw(keep_upper keep_lower)], | ||||
|             }, | ||||
|             { | ||||
|                 label       => 'Rotate lower part', | ||||
|                 options     => [qw(rotate_lower)], | ||||
|             }, | ||||
|             { | ||||
|                 sizer => $cut_button_sizer, | ||||
|             }, | ||||
|  | @ -73,7 +86,7 @@ sub new { | |||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         label_width => 50, | ||||
|         label_width => 120, | ||||
|     ); | ||||
|      | ||||
|     # left pane with tree | ||||
|  | @ -112,10 +125,15 @@ sub perform_cut { | |||
|      | ||||
|     my ($upper_object, $lower_object) = $self->{model_object}->cut($self->{cut_options}{z}); | ||||
|     $self->{new_model_objects} = []; | ||||
|     push @{$self->{new_model_objects}}, $upper_object | ||||
|         if $self->{cut_options}{keep_upper} && defined $upper_object; | ||||
|     push @{$self->{new_model_objects}}, $lower_object | ||||
|         if $self->{cut_options}{keep_lower} && defined $lower_object; | ||||
|     if ($self->{cut_options}{keep_upper} && defined $upper_object) { | ||||
|         push @{$self->{new_model_objects}}, $upper_object; | ||||
|     } | ||||
|     if ($self->{cut_options}{keep_lower} && defined $lower_object) { | ||||
|         push @{$self->{new_model_objects}}, $lower_object; | ||||
|         if ($self->{cut_options}{rotate_lower}) { | ||||
|             $lower_object->rotate_x(PI); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     $self->Close; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci