mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	New raft_layers option. #123
This commit is contained in:
		
							parent
							
								
									a016a06fa6
								
							
						
					
					
						commit
						177f1a9bf0
					
				
					 6 changed files with 28 additions and 7 deletions
				
			
		|  | @ -578,6 +578,14 @@ our $Options = { | |||
|         type    => 'i', | ||||
|         default => 0, | ||||
|     }, | ||||
|     'raft_layers' => { | ||||
|         label   => 'Raft layers', | ||||
|         tooltip => 'Number of total raft layers to insert below the object(s).', | ||||
|         sidetext => 'layers', | ||||
|         cli     => 'raft-layers=i', | ||||
|         type    => 'i', | ||||
|         default => 0, | ||||
|     }, | ||||
|     'start_gcode' => { | ||||
|         label   => 'Start G-code', | ||||
|         tooltip => 'This start procedure is inserted at the beginning of the output file, right after the temperature control commands for extruder and bed. If Slic3r detects M104 or M190 in your custom codes, such commands will not be prepended automatically. Note that you can use placeholder variables for all Slic3r settings, so you can put a "M104 S[first_layer_temperature]" command wherever you want.', | ||||
|  |  | |||
|  | @ -456,6 +456,10 @@ sub build { | |||
|             title => 'Support material', | ||||
|             options => [qw(support_material support_material_threshold support_material_pattern support_material_spacing support_material_angle)], | ||||
|         }, | ||||
|         { | ||||
|             title => 'Raft', | ||||
|             options => [qw(raft_layers)], | ||||
|         }, | ||||
|     ]); | ||||
|      | ||||
|     $self->add_options_page('Notes', 'note.png', optgroups => [ | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ package Slic3r::Layer; | |||
| use Moo; | ||||
| 
 | ||||
| use List::Util qw(first); | ||||
| use Slic3r::Geometry qw(scale); | ||||
| use Slic3r::Geometry::Clipper qw(union_ex); | ||||
| 
 | ||||
| has 'id'                => (is => 'rw', required => 1, trigger => 1); # sequential number of layer, 0-based | ||||
|  | @ -32,11 +33,16 @@ sub _trigger_id { | |||
| sub _build_slice_z { | ||||
|     my $self = shift; | ||||
|      | ||||
|     if ($self->id == 0) { | ||||
|         return $Slic3r::Config->get_value('first_layer_height') / 2 / &Slic3r::SCALING_FACTOR; | ||||
|     if ($Slic3r::Config->raft_layers == 0) { | ||||
|         if ($self->id == 0) { | ||||
|             return scale $Slic3r::Config->get_value('first_layer_height') / 2; | ||||
|         } | ||||
|         return scale($Slic3r::Config->get_value('first_layer_height') + ($self->id-1 + 0.5) * $Slic3r::Config->layer_height); | ||||
|     } else { | ||||
|         return -1 if $self->id < $Slic3r::Config->raft_layers; | ||||
|         my $object_layer_id = $self->id - $Slic3r::Config->raft_layers; | ||||
|         return scale ($object_layer_id + 0.5) * $Slic3r::Config->layer_height; | ||||
|     } | ||||
|     return ($Slic3r::Config->get_value('first_layer_height') + (($self->id-1) * $Slic3r::Config->layer_height) + ($Slic3r::Config->layer_height/2)) | ||||
|         / &Slic3r::SCALING_FACTOR;  #/ | ||||
| } | ||||
| 
 | ||||
| # Z used for printing in scaled coordinates | ||||
|  |  | |||
|  | @ -173,9 +173,10 @@ sub slice { | |||
|     } | ||||
|      | ||||
|     # remove empty layers from bottom | ||||
|     while (@{$self->layers} && !@{$self->layers->[0]->slices} && !map @{$_->thin_walls}, @{$self->layers->[0]->regions}) { | ||||
|         shift @{$self->layers}; | ||||
|         for (my $i = 0; $i <= $#{$self->layers}; $i++) { | ||||
|     my $first_object_layer_id = $Slic3r::Config->raft_layers; | ||||
|     while (@{$self->layers} && !@{$self->layers->[$first_object_layer_id]->slices} && !map @{$_->thin_walls}, @{$self->layers->[$first_object_layer_id]->regions}) { | ||||
|         splice @{$self->layers}, $first_object_layer_id, 1; | ||||
|         for (my $i = $first_object_layer_id; $i <= $#{$self->layers}; $i++) { | ||||
|             $self->layers->[$i]->id($i); | ||||
|         } | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci