diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index c52576acf..a3a85ee56 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -29,6 +29,7 @@ use Slic3r::Surface::Collection; our $nozzle_diameter = 0.45; our $print_center = [100,100]; # object will be centered around this point our $use_relative_e_distances = 0; +our $z_offset = 0; # filament options our $filament_diameter = 3; # mm diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 2f2e3c286..e24ae4e1f 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -187,7 +187,7 @@ sub export_gcode { foreach my $layer (@{ $self->layers }) { # go to layer - printf $fh $extruder->move_z($layer->z * $Slic3r::resolution); + printf $fh $extruder->move_z($Slic3r::z_offset + $layer->z * $Slic3r::resolution); # extrude skirts printf $fh $extruder->extrude_loop($_, 'skirt') for @{ $layer->skirts }; diff --git a/slic3r.pl b/slic3r.pl index 842bf3021..4cc4935ca 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -24,6 +24,7 @@ GetOptions( 'nozzle-diameter=f' => \$Slic3r::nozzle_diameter, 'print-center=s' => \$Slic3r::print_center, 'use-relative-e-distances' => \$Slic3r::use_relative_e_distances, + 'z-offset=f' => \$Slic3r::z_offset, # filament options 'filament-diameter=f' => \$Slic3r::filament_diameter, @@ -137,6 +138,8 @@ Usage: slic3r.pl [ OPTIONS ] file.stl (default: 100,100) --use-relative-e-distances Use relative distances for extrusion in GCODE output + --z-offset Additional height in mm to add to vertical coordinates + (+/-, default: $Slic3r::z_offset) Filament options: --filament-diameter Diameter of your raw filament (default: $Slic3r::filament_diameter)