mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Support material: refactoring
This commit is contained in:
		
							parent
							
								
									a24ffee2aa
								
							
						
					
					
						commit
						cc695c6c22
					
				
					 2 changed files with 29 additions and 19 deletions
				
			
		|  | @ -295,6 +295,7 @@ sub polygon_has_vertex { | |||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| # polygon must be simple (non complex) and ccw | ||||
| sub polygon_is_convex { | ||||
|     my ($points) = @_; | ||||
|     for (my $i = 0; $i <= $#$points; $i++) { | ||||
|  |  | |||
|  | @ -496,7 +496,9 @@ sub generate_support_material { | |||
|         ); | ||||
|     } | ||||
|      | ||||
|     # now apply the pattern to layers below unsupported surfaces | ||||
|     # now determine where to apply the pattern below unsupported surfaces | ||||
|     my %layers = (); | ||||
|     { | ||||
|         my (@a, @b) = (); | ||||
|         for (my $i = $#{$self->layers}; $i >=0; $i--) { | ||||
|             my $layer = $self->layers->[$i]; | ||||
|  | @ -506,11 +508,7 @@ sub generate_support_material { | |||
|                     [ map @$_, @b ], | ||||
|                     [ map @$_, map $_->expolygon->offset_ex(scale $Slic3r::flow_width), @{$layer->slices} ], | ||||
|                 )}; | ||||
|             $layer->support_fills(Slic3r::ExtrusionPath::Collection->new); | ||||
|             foreach my $expolygon (@c) { | ||||
|                 push @{$layer->support_fills->paths}, map $_->clip_with_expolygon($expolygon), | ||||
|                     map $_->clip_with_polygon($expolygon->bounding_box_polygon), @$support_pattern; | ||||
|             } | ||||
|                 $layers{$i} = [@c]; | ||||
|             } | ||||
|             @b = @{union_ex([ map @$_, @c, @a ])}; | ||||
|             @a = map $_->expolygon->offset_ex(scale 2), | ||||
|  | @ -520,6 +518,17 @@ sub generate_support_material { | |||
|         } | ||||
|     } | ||||
|      | ||||
|     # apply the pattern to layers | ||||
|     foreach my $layer_id (keys %layers) { | ||||
|         my $layer = $self->layers->[$layer_id]; | ||||
|         $layer->support_fills(Slic3r::ExtrusionPath::Collection->new); | ||||
|         foreach my $expolygon (@{ $layers{$layer_id} }) { | ||||
|             push @{$layer->support_fills->paths}, map $_->clip_with_expolygon($expolygon), | ||||
|                 map $_->clip_with_polygon($expolygon->bounding_box_polygon), @$support_pattern; | ||||
|         }; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| sub export_gcode { | ||||
|     my $self = shift; | ||||
|     my ($file) = @_; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci