mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	concentric - new superfast infill pattern
This commit is contained in:
		
							parent
							
								
									f3b689d4e0
								
							
						
					
					
						commit
						0ab1fd4c19
					
				
					 4 changed files with 59 additions and 2 deletions
				
			
		|  | @ -95,12 +95,12 @@ our $Options = { | |||
|     'fill_pattern' => { | ||||
|         label   => 'Fill pattern', | ||||
|         type    => 'select', | ||||
|         values  => [qw(rectilinear line hilbertcurve archimedeanchords octagramspiral)], | ||||
|         values  => [qw(rectilinear line concentric hilbertcurve archimedeanchords octagramspiral)], | ||||
|     }, | ||||
|     'solid_fill_pattern' => { | ||||
|         label   => 'Solid fill pattern', | ||||
|         type    => 'select', | ||||
|         values  => [qw(rectilinear hilbertcurve archimedeanchords octagramspiral)], | ||||
|         values  => [qw(rectilinear concentric hilbertcurve archimedeanchords octagramspiral)], | ||||
|     }, | ||||
|     'fill_density' => { | ||||
|         label   => 'Fill density', | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ use Moo; | |||
| 
 | ||||
| use Slic3r::Fill::ArchimedeanChords; | ||||
| use Slic3r::Fill::Base; | ||||
| use Slic3r::Fill::Concentric; | ||||
| use Slic3r::Fill::Flowsnake; | ||||
| use Slic3r::Fill::HilbertCurve; | ||||
| use Slic3r::Fill::Line; | ||||
|  | @ -26,6 +27,7 @@ our %FillTypes = ( | |||
|     octagramspiral      => 'Slic3r::Fill::OctagramSpiral', | ||||
|     hilbertcurve        => 'Slic3r::Fill::HilbertCurve', | ||||
|     line                => 'Slic3r::Fill::Line', | ||||
|     concentric          => 'Slic3r::Fill::Concentric', | ||||
| ); | ||||
| 
 | ||||
| sub BUILD { | ||||
|  |  | |||
							
								
								
									
										54
									
								
								lib/Slic3r/Fill/Concentric.pm
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								lib/Slic3r/Fill/Concentric.pm
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | |||
| package Slic3r::Fill::Concentric; | ||||
| use Moo; | ||||
| 
 | ||||
| extends 'Slic3r::Fill::Base'; | ||||
| 
 | ||||
| use XXX; | ||||
| 
 | ||||
| sub fill_surface { | ||||
|     my $self = shift; | ||||
|     my ($surface, %params) = @_; | ||||
|      | ||||
|     # no rotation is supported for this infill pattern | ||||
|      | ||||
|     my $flow_width_res = $params{flow_width} / $Slic3r::resolution; | ||||
|     my $distance = $flow_width_res / $params{density}; | ||||
|      | ||||
|     my @contour_loops = (); | ||||
|     my @hole_loops = (); | ||||
|     my @last_offsets = ($surface->expolygon->offset_ex($distance)); | ||||
|     while (@last_offsets) { | ||||
|         my @new_offsets = (); | ||||
|         foreach my $expolygon (@last_offsets) { | ||||
|             my @offsets = $expolygon->offset_ex(-$distance); | ||||
|             foreach my $offset (@offsets) { | ||||
|                 push @new_offsets, $offset; | ||||
|                 push @contour_loops, $offset->contour; | ||||
|                 push @hole_loops, $offset->holes; | ||||
|             } | ||||
|         } | ||||
|         @last_offsets = @new_offsets; | ||||
|     } | ||||
|      | ||||
|     my @loops = (@contour_loops, reverse @hole_loops); | ||||
|      | ||||
|     # make paths | ||||
|     my @paths = (); | ||||
|     my $cur_pos = Slic3r::Point->new(0,0); | ||||
|     foreach my $loop (map Slic3r::ExtrusionLoop->cast($_), @loops) { | ||||
|         # find the point of the loop that is closest to the current extruder position | ||||
|         $cur_pos = $loop->nearest_point_to($cur_pos); | ||||
|          | ||||
|         # split the loop at the starting point and make a path | ||||
|         my $path = $loop->split_at($cur_pos); | ||||
|      | ||||
|         # clip the path to avoid the extruder to get exactly on the first point of the loop | ||||
|         $path->clip_end($Slic3r::flow_width / $Slic3r::resolution); | ||||
|          | ||||
|         push @paths, $path->p; | ||||
|     } | ||||
|      | ||||
|     return @paths; | ||||
| } | ||||
| 
 | ||||
| 1; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci