mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Better pruning of thin walls to avoid unwanted extra extrusions. Includes regression test. #1794
Conflicts: lib/Slic3r/Layer/Region.pm
This commit is contained in:
		
							parent
							
								
									a344d68257
								
							
						
					
					
						commit
						2295d48947
					
				
					 4 changed files with 74 additions and 5 deletions
				
			
		|  | @ -93,14 +93,14 @@ sub make_perimeters { | |||
|                     # the minimum thickness of a single loop is: | ||||
|                     # width/2 + spacing/2 + spacing/2 + width/2 | ||||
|                     @offsets = @{offset2(\@last, -(0.5*$pwidth + 0.5*$pspacing - 1), +(0.5*$pspacing - 1))}; | ||||
|                  | ||||
|                      | ||||
|                     # look for thin walls | ||||
|                     if ($self->config->thin_walls) { | ||||
|                         my $diff = diff_ex( | ||||
|                             \@last, | ||||
|                             offset(\@offsets, +0.5*$pwidth), | ||||
|                         ); | ||||
|                         push @thin_walls, grep abs($_->area) >= $gap_area_threshold, @$diff; | ||||
|                         push @thin_walls, @$diff; | ||||
|                     } | ||||
|                 } else { | ||||
|                     @offsets = @{offset2(\@last, -(1.5*$pspacing - 1), +(0.5*$pspacing - 1))}; | ||||
|  | @ -222,15 +222,29 @@ sub make_perimeters { | |||
|     $self->perimeters->append(@loops); | ||||
|      | ||||
|     # process thin walls by collapsing slices to single passes | ||||
|     my $min_thin_wall_width = $pwidth/3; | ||||
|     my $min_thin_wall_length = 2*$pwidth; | ||||
|     @thin_walls = @{offset2_ex([ map @$_, @thin_walls ], -0.5*$min_thin_wall_width, +0.5*$min_thin_wall_width)}; | ||||
|     if (@thin_walls) { | ||||
|         if (0) { | ||||
|             require "Slic3r/SVG.pm"; | ||||
|             Slic3r::SVG::output( | ||||
|                 "thin_walls.svg", | ||||
|                 no_arrows => 1, | ||||
|                 expolygons      => \@thin_walls, | ||||
|                 red_polylines   => [ map $_->polygon->split_at_first_point, @{$self->perimeters} ], | ||||
|             ); | ||||
|         } | ||||
|          | ||||
|         my @p = map $_->medial_axis($pspacing), @thin_walls; | ||||
|         my @paths = (); | ||||
|         for my $p (@p) { | ||||
|             next if $p->length <= $pspacing * 2; | ||||
|             next if $p->length < $min_thin_wall_length; | ||||
|             my %params = ( | ||||
|                 role        => EXTR_ROLE_EXTERNAL_PERIMETER, | ||||
|                 mm3_per_mm  => $mm3_per_mm, | ||||
|             ); | ||||
|             printf "len = %s\n", unscale($p->length); | ||||
|             push @paths, $p->isa('Slic3r::Polygon') | ||||
|                 ? Slic3r::ExtrusionLoop->new(polygon  => $p, %params) | ||||
|                 : Slic3r::ExtrusionPath->new(polyline => $p, %params); | ||||
|  |  | |||
|  | @ -50,7 +50,7 @@ sub output { | |||
|              | ||||
|             my $g = $svg->group( | ||||
|                 style => { | ||||
|                     'stroke-width' => 2, | ||||
|                     'stroke-width' => 0, | ||||
|                     'stroke' => $colour || 'black', | ||||
|                     'fill' => ($type !~ /polygons/ ? 'none' : ($colour || 'grey')), | ||||
|                     'fill-type' => $filltype, | ||||
|  | @ -68,7 +68,7 @@ sub output { | |||
|              | ||||
|             my $g = $svg->group( | ||||
|                 style => { | ||||
|                     'stroke-width' => 2, | ||||
|                     'stroke-width' => ($method eq 'polyline') ? 1 : 0, | ||||
|                     'stroke' => $colour || 'black', | ||||
|                     'fill' => ($type !~ /polygons/ ? 'none' : ($colour || 'grey')), | ||||
|                 }, | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci