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)
--use-relative-e-distances
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
(+/-, default: 0)
--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 $print_center = [100,100]; # object will be centered around this point
our $use_relative_e_distances = 0;
our $no_extrusion = 0;
our $extrusion_axis = 'E';
our $z_offset = 0;
our $gcode_arcs = 0;
our $g0 = 0;

View File

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

View File

@ -181,7 +181,7 @@ sub retract {
# reset extrusion distance during retracts
# this makes sure we leave sufficient precision in the firmware
if (!$Slic3r::use_relative_e_distances) {
$gcode .= "G92 E0\n";
$gcode .= "G92 " . $Slic3r::extrusion_axis . "0\n";
$self->extrusion_distance(0);
}
@ -278,10 +278,10 @@ sub _Gx {
}
# 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($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;

View File

@ -17,7 +17,7 @@ sub new {
my %panels = (
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 => {
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;
print $fh "G90 ; use absolute coordinates\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) {
print $fh "M83 ; use relative distances for extrusion\n";
} else {

View File

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