mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	New --resolution option to simplify input models
This commit is contained in:
		
							parent
							
								
									10b6bc9d15
								
							
						
					
					
						commit
						cf5adca928
					
				
					 5 changed files with 30 additions and 7 deletions
				
			
		|  | @ -37,6 +37,15 @@ our $Options = { | |||
|         default => $Slic3r::have_threads ? 2 : 1, | ||||
|         readonly => !$Slic3r::have_threads, | ||||
|     }, | ||||
|     'resolution' => { | ||||
|         label   => 'Resolution', | ||||
|         tooltip => 'Minimum detail resolution, used to simplify the input file for speeding up the slicing job and reducing memory usage. High-resolution models often carry more detail than printers can render. Set to zero to disable any simplification and use full resolution from input.', | ||||
|         sidetext => 'mm', | ||||
|         cli     => 'resolution=f', | ||||
|         type    => 'f', | ||||
|         min     => 0, | ||||
|         default => 0, | ||||
|     }, | ||||
| 
 | ||||
|     # output options | ||||
|     'output_filename_format' => { | ||||
|  |  | |||
|  | @ -517,10 +517,10 @@ sub build { | |||
|             title => 'Flow', | ||||
|             options => [qw(bridge_flow_ratio)], | ||||
|         }, | ||||
|         $Slic3r::have_threads ? { | ||||
|         { | ||||
|             title => 'Other', | ||||
|             options => [qw(threads)], | ||||
|         } : (), | ||||
|             options => [($Slic3r::have_threads ? qw(threads) : ()), qw(resolution)], | ||||
|         }, | ||||
|     ]); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -313,6 +313,16 @@ sub size { | |||
|     return [ $bb[X2] - $bb[X1], $bb[Y2] - $bb[Y1] ]; | ||||
| } | ||||
| 
 | ||||
| sub _simplify_slices { | ||||
|     my $self = shift; | ||||
|     my ($distance) = @_; | ||||
|      | ||||
|     foreach my $layer (map @{$_->layers}, @{$self->objects}) { | ||||
|         @$_ = map $_->simplify($distance), @$_ | ||||
|             for $layer->slices, (map $_->slices, @{$layer->regions}); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| sub export_gcode { | ||||
|     my $self = shift; | ||||
|     my %params = @_; | ||||
|  | @ -326,6 +336,11 @@ sub export_gcode { | |||
|     $status_cb->(10, "Processing triangulated mesh"); | ||||
|     $_->slice for @{$self->objects}; | ||||
|      | ||||
|     if ($Slic3r::Config->resolution) { | ||||
|         $status_cb->(15, "Simplifying input"); | ||||
|         $self->_simplify_slices(scale $Slic3r::Config->resolution); | ||||
|     } | ||||
|      | ||||
|     # make perimeters | ||||
|     # this will add a set of extrusion loops to each layer | ||||
|     # as well as generate infill boundaries | ||||
|  | @ -334,10 +349,7 @@ sub export_gcode { | |||
|      | ||||
|     # simplify slices (both layer and region slices), | ||||
|     # we only need the max resolution for perimeters | ||||
|     foreach my $layer (map @{$_->layers}, @{$self->objects}) { | ||||
|         @$_ = map $_->simplify(&Slic3r::SCALED_RESOLUTION), @$_ | ||||
|             for $layer->slices, (map $_->slices, @{$layer->regions}); | ||||
|     } | ||||
|     $self->_simplify_slices(&Slic3r::SCALED_RESOLUTION); | ||||
|      | ||||
|     # this will assign a type (top/bottom/internal) to $layerm->slices | ||||
|     # and transform $layerm->fill_surfaces from expolygon  | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci