mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-20 07:11:12 -06:00 
			
		
		
		
	New --support-material-pattern and --support-material-angle options
This commit is contained in:
		
							parent
							
								
									e72bd56b9d
								
							
						
					
					
						commit
						bf1aba3d08
					
				
					 8 changed files with 50 additions and 21 deletions
				
			
		|  | @ -159,10 +159,16 @@ The author is Alessandro Ranellucci. | |||
|                             the default commands (turn off temperature [M104 S0], | ||||
|                             home X axis [G28 X], disable motors [M84]). | ||||
|         --layer-gcode       Load layer-change G-code from the supplied file (default: nothing). | ||||
|         --support-material  Generate support material for overhangs | ||||
|         --extra-perimeters  Add more perimeters when needed (default: yes) | ||||
|         --randomize-start   Randomize starting point across layers (default: yes) | ||||
|        | ||||
|        Support material options: | ||||
|         --support-material  Generate support material for overhangs | ||||
|         --support-material-pattern | ||||
|                             Pattern to use for support material (default: rectilinear) | ||||
|        --support-material-angle | ||||
|                             Support material angle in degrees (range: 0-90, default: 0) | ||||
|        | ||||
|        Retraction options: | ||||
|         --retract-length    Length of retraction in mm when pausing extrusion  | ||||
|                             (default: 1) | ||||
|  |  | |||
|  | @ -123,6 +123,8 @@ our $fill_angle         = 45; | |||
| our $extra_perimeters   = 1; | ||||
| our $randomize_start    = 1; | ||||
| our $support_material   = 0; | ||||
| our $support_material_pattern = 'rectilinear'; | ||||
| our $support_material_angle = 0; | ||||
| our $support_material_tool = 0; | ||||
| our $start_gcode = "G28 ; home all axes"; | ||||
| our $end_gcode = <<"END"; | ||||
|  |  | |||
|  | @ -16,8 +16,8 @@ our $Options = { | |||
|         cli     => 'notes=s', | ||||
|         type    => 's', | ||||
|         multiline => 1, | ||||
|         width   => 220, | ||||
|         height  => 130, | ||||
|         width   => 400, | ||||
|         height  => 100, | ||||
|         serialize   => sub { join '\n', split /\R/, $_[0] }, | ||||
|         deserialize => sub { join "\n", split /\\n/, $_[0] }, | ||||
|     }, | ||||
|  | @ -284,8 +284,20 @@ our $Options = { | |||
|         cli     => 'support-material!', | ||||
|         type    => 'bool', | ||||
|     }, | ||||
|     'support_material_pattern' => { | ||||
|         label   => 'Pattern', | ||||
|         cli     => 'support-material-pattern=s', | ||||
|         type    => 'select', | ||||
|         values  => [qw(rectilinear honeycomb)], | ||||
|         labels  => [qw(rectilinear honeycomb)], | ||||
|     }, | ||||
|     'support_material_angle' => { | ||||
|         label   => 'Angle (°)', | ||||
|         cli     => 'support-material-angle=i', | ||||
|         type    => 'i', | ||||
|     }, | ||||
|     'support_material_tool' => { | ||||
|         label   => 'Tool used to extrude support material', | ||||
|         label   => 'Extruder', | ||||
|         cli     => 'support-material-tool=i', | ||||
|         type    => 'select', | ||||
|         values  => [0,1], | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ use Moo; | |||
| has 'print'               => (is => 'rw'); | ||||
| has 'layer'               => (is => 'rw'); | ||||
| has 'max_print_dimension' => (is => 'rw'); | ||||
| has 'angle'               => (is => 'rw', default => sub { $Slic3r::fill_angle }); | ||||
| 
 | ||||
| use constant PI => 4 * atan2(1, 1); | ||||
| 
 | ||||
|  | @ -16,7 +17,7 @@ sub infill_direction { | |||
|      | ||||
|     # set infill angle | ||||
|     my (@rotate, @shift); | ||||
|     $rotate[0] = Slic3r::Geometry::deg2rad($Slic3r::fill_angle); | ||||
|     $rotate[0] = Slic3r::Geometry::deg2rad($self->angle); | ||||
|     $rotate[1] = [ $self->max_print_dimension * sqrt(2) / 2, $self->max_print_dimension * sqrt(2) / 2 ]; | ||||
|     @shift = @{$rotate[1]}; | ||||
|      | ||||
|  | @ -24,7 +25,7 @@ sub infill_direction { | |||
|         # alternate fill direction | ||||
|         my $layer_num = $self->layer->id / $surface->depth_layers; | ||||
|         my $angle = $self->angles->[$layer_num % @{$self->angles}]; | ||||
|         $rotate[0] = Slic3r::Geometry::deg2rad($Slic3r::fill_angle) + $angle if $angle; | ||||
|         $rotate[0] = Slic3r::Geometry::deg2rad($self->angle) + $angle if $angle; | ||||
|     } | ||||
|          | ||||
|     # use bridge angle | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ sub fill_surface { | |||
|                 ($_[X] >= ($distance_between_lines - $line_oscillation) - $tolerance) && ($_[X] <= ($distance_between_lines + $line_oscillation) + $tolerance) | ||||
|                     && $_[Y] <= $diagonal_distance | ||||
|             } | ||||
|             : sub { abs($_[X]) - $distance_between_lines <= $tolerance && $_[Y] <= $diagonal_distance }; | ||||
|             : sub { abs($_[X] - $distance_between_lines) <= $tolerance && $_[Y] <= $diagonal_distance }; | ||||
|          | ||||
|         foreach my $path ($collection->shortest_path) { | ||||
|             if (@paths) { | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ sub new { | |||
|         }, | ||||
|         print => { | ||||
|             title => 'Print settings', | ||||
|             options => [qw(perimeters solid_layers fill_density fill_angle fill_pattern solid_fill_pattern randomize_start support_material)], | ||||
|             options => [qw(perimeters solid_layers fill_density fill_angle fill_pattern solid_fill_pattern randomize_start)], | ||||
|         }, | ||||
|         retract => { | ||||
|             title => 'Retraction', | ||||
|  | @ -53,7 +53,7 @@ sub new { | |||
|         cooling => { | ||||
|             title => 'Cooling', | ||||
|             options => [qw(cooling min_fan_speed max_fan_speed bridge_fan_speed fan_below_layer_time slowdown_below_layer_time min_print_speed disable_fan_first_layers fan_always_on)], | ||||
|             label_width => 300, | ||||
|             label_width => 450, | ||||
|         }, | ||||
|         skirt => { | ||||
|             title => 'Skirt', | ||||
|  | @ -78,12 +78,16 @@ sub new { | |||
|         }, | ||||
|         other => { | ||||
|             title => 'Other', | ||||
|             options => [ ($Slic3r::have_threads ? qw(threads) : ()), qw(extra_perimeters support_material_tool) ], | ||||
|             options => [ ($Slic3r::have_threads ? qw(threads) : ()), qw(extra_perimeters) ], | ||||
|         }, | ||||
|         notes => { | ||||
|             title => 'Notes', | ||||
|             options => [qw(notes)], | ||||
|         }, | ||||
|         support_material => { | ||||
|             title => 'Support material', | ||||
|             options => [qw(support_material support_material_tool)], | ||||
|         }, | ||||
|     ); | ||||
|     $self->{panels} = \%panels; | ||||
|      | ||||
|  | @ -108,8 +112,8 @@ sub new { | |||
|     }; | ||||
|      | ||||
|     my @tabs = ( | ||||
|         $make_tab->([qw(accuracy skirt retract)], [qw(print notes)]), | ||||
|         $make_tab->([qw(cooling)]), | ||||
|         $make_tab->([qw(accuracy skirt support_material)], [qw(print retract)]), | ||||
|         $make_tab->([qw(cooling notes)]), | ||||
|         $make_tab->([qw(printer filament)], [qw(print_speed speed)]), | ||||
|         $make_tab->([qw(gcode)]), | ||||
|         $make_tab->([qw(extrusion sequential_printing)], [qw(output other)]), | ||||
|  |  | |||
|  | @ -545,20 +545,18 @@ sub generate_support_material { | |||
|      | ||||
|     # generate paths for the pattern that we're going to use | ||||
|     Slic3r::debugf "Generating patterns\n"; | ||||
|     my $support_patterns = []; | ||||
|     my $support_patterns = [];  # in case we want cross-hatching | ||||
|     { | ||||
|         my @support_material_areas = @{union_ex([ map @$_, @unsupported_expolygons ])}; | ||||
|          | ||||
|         my $fill = Slic3r::Fill->new(print => $params{print}); | ||||
|         foreach my $layer (map $self->layers->[$_], 0,1,2) {  # ugly hack | ||||
|             $fill->filler('honeycomb')->layer($layer); | ||||
|         my $filler = $fill->filler($Slic3r::support_material_pattern); | ||||
|         $filler->angle($Slic3r::support_material_angle); | ||||
|         { | ||||
|             my @patterns = (); | ||||
|             foreach my $expolygon (@support_material_areas) { | ||||
|                 my @paths = $fill->filler('honeycomb')->fill_surface( | ||||
|                     Slic3r::Surface->new( | ||||
|                         expolygon       => $expolygon, | ||||
|                         #bridge_angle    => $Slic3r::fill_angle + 45 + $angle, | ||||
|                     ), | ||||
|                 my @paths = $filler->fill_surface( | ||||
|                     Slic3r::Surface->new(expolygon => $expolygon), | ||||
|                     density         => 0.20, | ||||
|                     flow_spacing    => $Slic3r::flow->spacing, | ||||
|                 ); | ||||
|  |  | |||
|  | @ -204,10 +204,16 @@ $j | |||
|                         the default commands (turn off temperature [M104 S0], | ||||
|                         home X axis [G28 X], disable motors [M84]). | ||||
|     --layer-gcode       Load layer-change G-code from the supplied file (default: nothing). | ||||
|     --support-material  Generate support material for overhangs | ||||
|     --extra-perimeters  Add more perimeters when needed (default: yes) | ||||
|     --randomize-start   Randomize starting point across layers (default: yes) | ||||
|    | ||||
|    Support material options: | ||||
|     --support-material  Generate support material for overhangs | ||||
|     --support-material-pattern | ||||
|                         Pattern to use for support material (default: $Slic3r::support_material_pattern) | ||||
|     --support-material-angle | ||||
|                         Support material angle in degrees (range: 0-90, default: $Slic3r::support_material_angle) | ||||
|    | ||||
|    Retraction options: | ||||
|     --retract-length    Length of retraction in mm when pausing extrusion  | ||||
|                         (default: $Slic3r::retract_length) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci