New --extrusion-axis option; removed --no-extrusion

This commit is contained in:
Alessandro Ranellucci 2011-12-01 22:34:21 +01:00
parent 830965fc0b
commit 52c9897eda
7 changed files with 14 additions and 12 deletions

View File

@ -89,7 +89,8 @@ The author is Alessandro Ranellucci (me).
(default: 100,100) (default: 100,100)
--use-relative-e-distances --use-relative-e-distances
Use relative distances for extrusion in GCODE output Use relative distances for extrusion in GCODE output
--no-extrusion Do not output any E value in GCODE --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-arcs Use G2/G3 commands for native arcs (experimental, not supported --gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported

View File

@ -37,7 +37,7 @@ use Slic3r::TriangleMesh::IntersectionLine;
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 $use_relative_e_distances = 0; our $use_relative_e_distances = 0;
our $no_extrusion = 0; our $extrusion_axis = 'E';
our $z_offset = 0; our $z_offset = 0;
our $gcode_arcs = 0; our $gcode_arcs = 0;
our $g0 = 0; our $g0 = 0;

View File

@ -25,10 +25,10 @@ our $Options = {
cli => 'use-relative-e-distances', cli => 'use-relative-e-distances',
type => 'bool', type => 'bool',
}, },
'no_extrusion' => { 'extrusion_axis' => {
label => 'No extrusion', label => 'Extrusion axis',
cli => 'no-extrusion', cli => 'extrusion_axis',
type => 'bool', type => 's',
}, },
'z_offset' => { 'z_offset' => {
label => 'Z offset', label => 'Z offset',

View File

@ -181,7 +181,7 @@ sub retract {
# reset extrusion distance during retracts # reset extrusion distance during retracts
# this makes sure we leave sufficient precision in the firmware # this makes sure we leave sufficient precision in the firmware
if (!$Slic3r::use_relative_e_distances) { if (!$Slic3r::use_relative_e_distances) {
$gcode .= "G92 E0\n"; $gcode .= "G92 " . $Slic3r::extrusion_axis . "0\n";
$self->extrusion_distance(0); $self->extrusion_distance(0);
} }
@ -278,10 +278,10 @@ sub _Gx {
} }
# output extrusion distance # output extrusion distance
if ($e && !$Slic3r::no_extrusion) { if ($e && $Slic3r::extrusion_axis) {
$self->extrusion_distance(0) if $Slic3r::use_relative_e_distances; $self->extrusion_distance(0) if $Slic3r::use_relative_e_distances;
$self->extrusion_distance($self->extrusion_distance + $e); $self->extrusion_distance($self->extrusion_distance + $e);
$gcode .= sprintf " E%.5f", $self->extrusion_distance; $gcode .= sprintf " %s%.5f", $Slic3r::extrusion_axis, $self->extrusion_distance;
} }
$gcode .= sprintf " ; %s", $comment if $comment; $gcode .= sprintf " ; %s", $comment if $comment;

View File

@ -17,7 +17,7 @@ sub new {
my %panels = ( my %panels = (
printer => { printer => {
title => 'Printer', title => 'Printer',
options => [qw(nozzle_diameter print_center use_relative_e_distances no_extrusion z_offset)], options => [qw(nozzle_diameter print_center use_relative_e_distances extrusion_axis z_offset)],
}, },
filament => { filament => {
title => 'Filament', title => 'Filament',

View File

@ -472,7 +472,7 @@ sub export_gcode {
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::temperature if $Slic3r::temperature;
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";
print $fh "G92 E0 ; reset extrusion distance\n" if !$Slic3r::no_extrusion; printf $fh "G92 %s0 ; reset extrusion distance\n", $Slic3r::extrusion_axis if $Slic3r::extrusion_axis;
if ($Slic3r::use_relative_e_distances) { if ($Slic3r::use_relative_e_distances) {
print $fh "M83 ; use relative distances for extrusion\n"; print $fh "M83 ; use relative distances for extrusion\n";
} else { } else {

View File

@ -95,7 +95,8 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
(default: $Slic3r::print_center->[0],$Slic3r::print_center->[1]) (default: $Slic3r::print_center->[0],$Slic3r::print_center->[1])
--use-relative-e-distances --use-relative-e-distances
Use relative distances for extrusion in GCODE output Use relative distances for extrusion in GCODE output
--no-extrusion Do not output any E value in GCODE --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-arcs Use G2/G3 commands for native arcs (experimental, not supported --gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported