mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Bugfix: incorrect number of raft layers was generated when too few were requested. #1678
This commit is contained in:
		
							parent
							
								
									26f0fab27a
								
							
						
					
					
						commit
						130e8dd8e7
					
				
					 4 changed files with 55 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -26,17 +26,30 @@ sub BUILD {
 | 
			
		|||
 	
 | 
			
		||||
    # make layers taking custom heights into account
 | 
			
		||||
    my $print_z = my $slice_z = my $height = my $id = 0;
 | 
			
		||||
    my $first_object_layer_height = -1;
 | 
			
		||||
    
 | 
			
		||||
    # add raft layers
 | 
			
		||||
    if ($self->config->raft_layers > 0) {
 | 
			
		||||
        $id += $self->config->raft_layers;
 | 
			
		||||
        
 | 
			
		||||
        # raise first object layer Z by the thickness of the raft itself
 | 
			
		||||
        # plus the extra distance required by the support material logic
 | 
			
		||||
        $print_z += $Slic3r::Config->get_value('first_layer_height');
 | 
			
		||||
        $print_z += $Slic3r::Config->layer_height * ($self->config->raft_layers - 1);
 | 
			
		||||
        $id += $self->config->raft_layers;
 | 
			
		||||
        
 | 
			
		||||
        # at this stage we don't know which nozzles are actually used for the first layer
 | 
			
		||||
        # so we compute the average of all of them
 | 
			
		||||
        my $nozzle_diameter = sum(@{$Slic3r::Config->nozzle_diameter})/@{$Slic3r::Config->nozzle_diameter};
 | 
			
		||||
        my $distance = Slic3r::Print::SupportMaterial::contact_distance($nozzle_diameter);
 | 
			
		||||
        
 | 
			
		||||
        # force first layer print_z according to the contact distance
 | 
			
		||||
        # (the loop below will raise print_z by such height)
 | 
			
		||||
        $first_object_layer_height = $distance;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # loop until we have at least one layer and the max slice_z reaches the object height
 | 
			
		||||
    my $max_z = unscale $self->size->[Z];
 | 
			
		||||
    while (!@{$self->layers} || ($slice_z - $height) <= $max_z) {
 | 
			
		||||
    while (($slice_z - $height) <= $max_z) {
 | 
			
		||||
        # assign the default height to the layer according to the general settings
 | 
			
		||||
        $height = ($id == 0)
 | 
			
		||||
            ? $Slic3r::Config->get_value('first_layer_height')
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +66,10 @@ sub BUILD {
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if ($first_object_layer_height != -1 && !@{$self->layers}) {
 | 
			
		||||
            $height = $first_object_layer_height;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        $print_z += $height;
 | 
			
		||||
        $slice_z += $height/2;
 | 
			
		||||
        
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -174,7 +174,7 @@ sub contact_area {
 | 
			
		|||
                @{$layer->regions};
 | 
			
		||||
            my $nozzle_diameter = sum(@nozzle_diameters)/@nozzle_diameters;
 | 
			
		||||
            
 | 
			
		||||
            my $contact_z = $layer->print_z - $nozzle_diameter * 1.5;
 | 
			
		||||
            my $contact_z = $layer->print_z - contact_distance($nozzle_diameter);
 | 
			
		||||
            ###$contact_z = $layer->print_z - $layer->height;
 | 
			
		||||
            
 | 
			
		||||
            # ignore this contact area if it's too low
 | 
			
		||||
| 
						 | 
				
			
			@ -636,4 +636,10 @@ sub overlapping_layers {
 | 
			
		|||
    } 0..$#$support_z;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# class method
 | 
			
		||||
sub contact_distance {
 | 
			
		||||
    my ($nozzle_diameter) = @_;
 | 
			
		||||
    return $nozzle_diameter * 1.5;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue