From c2e710d0920f117b363f90c0b93e6e8c36eaf9e0 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 21 Oct 2014 21:41:11 +0200 Subject: [PATCH] Removed --g0 --- README.md | 2 -- lib/Slic3r/Config.pm | 2 +- lib/Slic3r/GCode.pm | 42 -------------------------------- lib/Slic3r/Print.pm | 5 +++- slic3r.pl | 2 -- t/retraction.t | 8 +----- utils/zsh/functions/_slic3r | 1 - xs/src/libslic3r/Print.cpp | 1 - xs/src/libslic3r/PrintConfig.cpp | 5 ---- xs/src/libslic3r/PrintConfig.hpp | 3 --- 10 files changed, 6 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 1dee1e918..8d39dbec2 100644 --- a/README.md +++ b/README.md @@ -136,8 +136,6 @@ The author of the Silk icon set is Mark James. --use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no) --gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported by all firmwares) - --g0 Use G0 commands for retraction (experimental, not supported by all - firmwares) --gcode-comments Make G-code verbose by adding comments (default: no) --vibration-limit Limit the frequency of moves on X and Y axes (Hz, set zero to disable; default: 0) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index d1aeb38cf..d91af1933 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -9,7 +9,7 @@ use List::Util qw(first max); our @Ignore = qw(duplicate_x duplicate_y multiply_x multiply_y support_material_tool acceleration adjust_overhang_flow standby_temperature scale rotate duplicate duplicate_grid rotate scale duplicate_grid start_perimeters_at_concave_points start_perimeters_at_non_overhang - randomize_start seal_position bed_size print_center); + randomize_start seal_position bed_size print_center g0); our $Options = print_config_def(); diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 9b8ed1622..d3237a599 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -459,34 +459,6 @@ sub unretract { return $gcode; } -sub G0 { - my $self = shift; - return $self->G1(@_) if !($self->config->g0 || $self->config->gcode_flavor eq 'mach3'); - return $self->_G0_G1("G0", @_); -} - -sub G1 { - my $self = shift; - return $self->_G0_G1("G1", @_); -} - -sub _G0_G1 { - my ($self, $gcode, $point, $z, $e, $F, $comment) = @_; - - if ($point) { - $gcode .= sprintf " X%.3f Y%.3f", - ($point->x * &Slic3r::SCALING_FACTOR) + $self->shift_x - $self->_extruder->extruder_offset->x, - ($point->y * &Slic3r::SCALING_FACTOR) + $self->shift_y - $self->_extruder->extruder_offset->y; #** - $self->last_pos($point->clone); - } - if (defined $z && (!defined $self->z || $z != $self->z)) { - $self->z($z); - $gcode .= sprintf " Z%.3f", $z; - } - - return $self->_Gx($gcode, $e, $F, $comment); -} - # convert a model-space scaled point into G-code coordinates sub point_to_gcode { my ($self, $point) = @_; @@ -497,20 +469,6 @@ sub point_to_gcode { ); } -sub _Gx { - my ($self, $gcode, $e, $F, $comment) = @_; - - $gcode .= sprintf " F%.3f", $F; - - # output extrusion distance - if ($e && $self->_extrusion_axis) { - $gcode .= sprintf " %s%.5f", $self->_extrusion_axis, $self->_extruder->extrude($e); - } - - $gcode .= " ; $comment" if $comment && $self->config->gcode_comments; - return "$gcode\n"; -} - sub set_extruder { my ($self, $extruder_id) = @_; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index f429aae80..79eb13e5d 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -875,7 +875,10 @@ sub write_gcode { if ($finished_objects > 0) { $gcodegen->set_shift(map unscale $copy->[$_], X,Y); print $fh $gcodegen->retract; - print $fh $gcodegen->G0($object->_copies_shift->negative, undef, 0, $gcodegen->config->travel_speed*60, 'move to origin position for next object'); + print $fh $gcodegen->travel_to_xy( + $gcodegen->point_to_gcode($object->_copies_shift->negative), + 'move to origin position for next object', + ); } my $buffer = Slic3r::GCode::CoolingBuffer->new( diff --git a/slic3r.pl b/slic3r.pl index 354bae3ac..6dce339ba 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -283,8 +283,6 @@ $j --use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no) --gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported by all firmwares) - --g0 Use G0 commands for retraction (experimental, not supported by all - firmwares) --gcode-comments Make G-code verbose by adding comments (default: no) --vibration-limit Limit the frequency of moves on X and Y axes (Hz, set zero to disable; default: $config->{vibration_limit}) diff --git a/t/retraction.t b/t/retraction.t index 6c96abd62..73356534f 100644 --- a/t/retraction.t +++ b/t/retraction.t @@ -44,7 +44,7 @@ use Slic3r::Test qw(_eq); # lift move or lift + change layer if (_eq($info->{dist_Z}, $print->print->config->get_at('retract_lift', $tool)) || (_eq($info->{dist_Z}, $conf->layer_height + $print->print->config->get_at('retract_lift', $tool)) && $print->print->config->get_at('retract_lift', $tool) > 0)) { - fail 'only lifting while retracted' if !$retracted[$tool] && !($conf->g0 && $info->{retracting}); + fail 'only lifting while retracted' if !$retracted[$tool]; fail 'double lift' if $lifted; $lifted = 1; } @@ -67,8 +67,6 @@ use Slic3r::Test qw(_eq); } else { fail 'retracted by the correct amount'; } - fail 'combining retraction and travel with G0' - if $cmd ne 'G0' && $conf->g0 && ($info->{dist_Z} || $info->{dist_XY}); } if ($info->{extruding}) { fail 'only extruding while not lifted' if $lifted; @@ -120,11 +118,7 @@ use Slic3r::Test qw(_eq); $duplicate = 2; $retract_tests->(' (duplicate)'); - $config->set('g0', 1); - $retract_tests->(' (G0 and duplicate)'); - $duplicate = 1; - $config->set('g0', 0); $config->set('infill_extruder', 2); $config->set('skirts', 4); $config->set('skirt_height', 3); diff --git a/utils/zsh/functions/_slic3r b/utils/zsh/functions/_slic3r index 10a0ce05b..41a36963f 100644 --- a/utils/zsh/functions/_slic3r +++ b/utils/zsh/functions/_slic3r @@ -26,7 +26,6 @@ _arguments -S \ '(--use-relative-e-distances --no-use-relative-e-distances)'--{no-,}use-relative-e-distances'[disable/enable relative E values]' \ '--extrusion-axis[specify letter associated with the extrusion axis]:extrusion axis letter' \ '(--gcode-arcs --no-gcode-arcs)'--{no-,}gcode-arcs'[disable/enable G2/G3 commands for native arcs]' \ - '(--g0 --no-g0)'--{no-,}g0'[disable/enable G0 commands for retraction]' \ '(--gcode-comments --no-gcode-comments)'--{no-,}gcode-comments'[disable/enable verbose G-code comments]' \ \ '*--filament-diameter[specify raw filament diameter]:raw filament diameter in mm' \ diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index d71cb4349..d0ec15cb5 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -183,7 +183,6 @@ Print::invalidate_state_by_config_options(const std::vector || *opt_key == "first_layer_bed_temperature" || *opt_key == "first_layer_speed" || *opt_key == "first_layer_temperature" - || *opt_key == "g0" || *opt_key == "gcode_arcs" || *opt_key == "gcode_comments" || *opt_key == "gcode_flavor" diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index f5b277134..3a34c32de 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -326,11 +326,6 @@ PrintConfigDef::build_def() { Options["first_layer_temperature"].min = 0; Options["first_layer_temperature"].max = 400; - Options["g0"].type = coBool; - Options["g0"].label = "Use G0 for travel moves"; - Options["g0"].tooltip = "Only enable this if your firmware supports G0 properly (thus decouples all axes using their maximum speeds instead of synchronizing them). Travel moves and retractions will be combined in single commands, speeding them print up."; - Options["g0"].cli = "g0!"; - Options["gap_fill_speed"].type = coFloat; Options["gap_fill_speed"].label = "Gap fill"; Options["gap_fill_speed"].category = "Speed"; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 29bfe6646..8f85d2f64 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -388,7 +388,6 @@ class PrintConfig : public GCodeConfig ConfigOptionFloatOrPercent first_layer_extrusion_width; ConfigOptionFloatOrPercent first_layer_speed; ConfigOptionInts first_layer_temperature; - ConfigOptionBool g0; ConfigOptionBool gcode_arcs; ConfigOptionFloat infill_acceleration; ConfigOptionBool infill_first; @@ -455,7 +454,6 @@ class PrintConfig : public GCodeConfig this->first_layer_speed.percent = true; this->first_layer_temperature.values.resize(1); this->first_layer_temperature.values[0] = 200; - this->g0.value = false; this->gcode_arcs.value = false; this->infill_acceleration.value = 0; this->infill_first.value = false; @@ -518,7 +516,6 @@ class PrintConfig : public GCodeConfig if (opt_key == "first_layer_extrusion_width") return &this->first_layer_extrusion_width; if (opt_key == "first_layer_speed") return &this->first_layer_speed; if (opt_key == "first_layer_temperature") return &this->first_layer_temperature; - if (opt_key == "g0") return &this->g0; if (opt_key == "gcode_arcs") return &this->gcode_arcs; if (opt_key == "infill_acceleration") return &this->infill_acceleration; if (opt_key == "infill_first") return &this->infill_first;