New --gcode-flavor option. extrusion_axis, use_relative_e_distances options hidden and implied. #158
This commit is contained in:
parent
23156f0abe
commit
615bcb27dd
@ -97,12 +97,10 @@ The author is Alessandro Ranellucci (me).
|
|||||||
--nozzle-diameter Diameter of nozzle in mm (default: 0.5)
|
--nozzle-diameter Diameter of nozzle in mm (default: 0.5)
|
||||||
--print-center Coordinates in mm of the point to center the print around
|
--print-center Coordinates in mm of the point to center the print around
|
||||||
(default: 100,100)
|
(default: 100,100)
|
||||||
--use-relative-e-distances
|
|
||||||
Use relative distances for extrusion in GCODE output
|
|
||||||
--extrusion-axis The axis used for extrusion; leave empty to disable extrusion
|
|
||||||
(default: E)
|
|
||||||
--z-offset Additional height in mm to add to vertical coordinates
|
--z-offset Additional height in mm to add to vertical coordinates
|
||||||
(+/-, default: 0)
|
(+/-, default: 0)
|
||||||
|
--gcode-flavor The type of G-code to generate (reprap/teacup/makerbot/mach3/no-extrusion,
|
||||||
|
default: reprap)
|
||||||
--gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported
|
--gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported
|
||||||
by all firmwares)
|
by all firmwares)
|
||||||
--g0 Use G0 commands for retraction (experimental, not supported by all
|
--g0 Use G0 commands for retraction (experimental, not supported by all
|
||||||
|
@ -48,9 +48,10 @@ our $output_filename_format = '[input_filename_base].gcode';
|
|||||||
# printer options
|
# printer options
|
||||||
our $nozzle_diameter = 0.5;
|
our $nozzle_diameter = 0.5;
|
||||||
our $print_center = [100,100]; # object will be centered around this point
|
our $print_center = [100,100]; # object will be centered around this point
|
||||||
|
our $z_offset = 0;
|
||||||
|
our $gcode_flavor = 'reprap';
|
||||||
our $use_relative_e_distances = 0;
|
our $use_relative_e_distances = 0;
|
||||||
our $extrusion_axis = 'E';
|
our $extrusion_axis = 'E';
|
||||||
our $z_offset = 0;
|
|
||||||
our $gcode_arcs = 0;
|
our $gcode_arcs = 0;
|
||||||
our $g0 = 0;
|
our $g0 = 0;
|
||||||
our $gcode_comments = 0;
|
our $gcode_comments = 0;
|
||||||
|
@ -40,6 +40,13 @@ our $Options = {
|
|||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => sub { join ',', @{$_[0]} },
|
||||||
deserialize => sub { [ split /,/, $_[0] ] },
|
deserialize => sub { [ split /,/, $_[0] ] },
|
||||||
},
|
},
|
||||||
|
'gcode_flavor' => {
|
||||||
|
label => 'G-code flavor',
|
||||||
|
cli => 'gcode-flavor=s',
|
||||||
|
type => 'select',
|
||||||
|
values => [qw(reprap teacup makerbot mach3 no-extrusion)],
|
||||||
|
labels => ['RepRap (Marlin/Sprinter)', 'Teacup', 'MakerBot', 'Mach3/EMC', 'No extrusion'],
|
||||||
|
},
|
||||||
'use_relative_e_distances' => {
|
'use_relative_e_distances' => {
|
||||||
label => 'Use relative E distances',
|
label => 'Use relative E distances',
|
||||||
cli => 'use-relative-e-distances',
|
cli => 'use-relative-e-distances',
|
||||||
@ -520,6 +527,9 @@ sub validate {
|
|||||||
die "Invalid value for --bridge-flow-ratio\n"
|
die "Invalid value for --bridge-flow-ratio\n"
|
||||||
if $Slic3r::bridge_flow_ratio <= 0;
|
if $Slic3r::bridge_flow_ratio <= 0;
|
||||||
|
|
||||||
|
# G-code flavors
|
||||||
|
$Slic3r::extrusion_axis = 'A' if $Slic3r::gcode_flavor eq 'mach3';
|
||||||
|
|
||||||
# legacy with existing config files
|
# legacy with existing config files
|
||||||
$Slic3r::small_perimeter_speed ||= $Slic3r::perimeter_speed;
|
$Slic3r::small_perimeter_speed ||= $Slic3r::perimeter_speed;
|
||||||
$Slic3r::bridge_speed ||= $Slic3r::infill_speed;
|
$Slic3r::bridge_speed ||= $Slic3r::infill_speed;
|
||||||
|
@ -21,7 +21,7 @@ sub new {
|
|||||||
my %panels = (
|
my %panels = (
|
||||||
printer => {
|
printer => {
|
||||||
title => 'Printer',
|
title => 'Printer',
|
||||||
options => [qw(nozzle_diameter print_center z_offset use_relative_e_distances extrusion_axis g0)],
|
options => [qw(nozzle_diameter print_center z_offset gcode_flavor g0)],
|
||||||
},
|
},
|
||||||
filament => {
|
filament => {
|
||||||
title => 'Filament',
|
title => 'Filament',
|
||||||
|
@ -546,16 +546,20 @@ sub export_gcode {
|
|||||||
print $fh "\n";
|
print $fh "\n";
|
||||||
|
|
||||||
# write start commands to file
|
# write start commands to file
|
||||||
printf $fh "M104 S%d ; set temperature\n", $Slic3r::temperature if $Slic3r::temperature;
|
printf $fh "M104 %s%d ; set temperature\n",
|
||||||
|
($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::temperature
|
||||||
|
if $Slic3r::temperature;
|
||||||
print $fh "$Slic3r::start_gcode\n";
|
print $fh "$Slic3r::start_gcode\n";
|
||||||
printf $fh "M109 S%d ; wait for temperature to be reached\n", $Slic3r::temperature if $Slic3r::temperature;
|
printf $fh "M109 %s%d ; wait for temperature to be reached\n",
|
||||||
|
($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::temperature
|
||||||
|
if $Slic3r::temperature && $Slic3r::gcode_flavor ne 'makerbot';
|
||||||
print $fh "G90 ; use absolute coordinates\n";
|
print $fh "G90 ; use absolute coordinates\n";
|
||||||
print $fh "G21 ; set units to millimeters\n";
|
print $fh "G21 ; set units to millimeters\n";
|
||||||
printf $fh "G92 %s0 ; reset extrusion distance\n", $Slic3r::extrusion_axis if $Slic3r::extrusion_axis;
|
if ($Slic3r::gcode_flavor =~ /^(?:reprap|teacup|makerbot)$/) {
|
||||||
if ($Slic3r::use_relative_e_distances) {
|
printf $fh "G92 %s0 ; reset extrusion distance\n", $Slic3r::extrusion_axis;
|
||||||
print $fh "M83 ; use relative distances for extrusion\n";
|
if (!$Slic3r::use_relative_e_distances && $Slic3r::gcode_flavor =~ /^(?:reprap|makerbot)$/) {
|
||||||
} else {
|
print $fh "M82 ; use absolute distances for extrusion\n";
|
||||||
print $fh "M82 ; use absolute distances for extrusion\n";
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# calculate X,Y shift to center print around specified origin
|
# calculate X,Y shift to center print around specified origin
|
||||||
|
@ -113,12 +113,10 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
|
|||||||
--nozzle-diameter Diameter of nozzle in mm (default: $Slic3r::nozzle_diameter)
|
--nozzle-diameter Diameter of nozzle in mm (default: $Slic3r::nozzle_diameter)
|
||||||
--print-center Coordinates in mm of the point to center the print around
|
--print-center Coordinates in mm of the point to center the print around
|
||||||
(default: $Slic3r::print_center->[0],$Slic3r::print_center->[1])
|
(default: $Slic3r::print_center->[0],$Slic3r::print_center->[1])
|
||||||
--use-relative-e-distances
|
|
||||||
Use relative distances for extrusion in GCODE output
|
|
||||||
--extrusion-axis The axis used for extrusion; leave empty to disable extrusion
|
|
||||||
(default: $Slic3r::extrusion_axis)
|
|
||||||
--z-offset Additional height in mm to add to vertical coordinates
|
--z-offset Additional height in mm to add to vertical coordinates
|
||||||
(+/-, default: $Slic3r::z_offset)
|
(+/-, default: $Slic3r::z_offset)
|
||||||
|
--gcode-flavor The type of G-code to generate (reprap/teacup/makerbot/mach3/no-extrusion,
|
||||||
|
default: $Slic3r::gcode_flavor)
|
||||||
--gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported
|
--gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported
|
||||||
by all firmwares)
|
by all firmwares)
|
||||||
--g0 Use G0 commands for retraction (experimental, not supported by all
|
--g0 Use G0 commands for retraction (experimental, not supported by all
|
||||||
|
Loading…
Reference in New Issue
Block a user