Bugfix: spiral vase was not working when extrusion axis was not E. #2350
This commit is contained in:
parent
c1e26a70f8
commit
2c64c3dd5b
@ -1,19 +1,28 @@
|
|||||||
package Slic3r::GCode::Reader;
|
package Slic3r::GCode::Reader;
|
||||||
use Moo;
|
use Moo;
|
||||||
|
|
||||||
|
has 'config' => (is => 'ro', default => sub { Slic3r::Config::GCode->new });
|
||||||
has 'X' => (is => 'rw', default => sub {0});
|
has 'X' => (is => 'rw', default => sub {0});
|
||||||
has 'Y' => (is => 'rw', default => sub {0});
|
has 'Y' => (is => 'rw', default => sub {0});
|
||||||
has 'Z' => (is => 'rw', default => sub {0});
|
has 'Z' => (is => 'rw', default => sub {0});
|
||||||
has 'E' => (is => 'rw', default => sub {0});
|
has 'E' => (is => 'rw', default => sub {0});
|
||||||
has 'F' => (is => 'rw', default => sub {0});
|
has 'F' => (is => 'rw', default => sub {0});
|
||||||
|
has '_extrusion_axis' => (is => 'rw', default => sub {"E"});
|
||||||
|
|
||||||
our $Verbose = 0;
|
our $Verbose = 0;
|
||||||
my @AXES = qw(X Y Z E);
|
my @AXES = qw(X Y Z E);
|
||||||
|
|
||||||
|
sub apply_print_config {
|
||||||
|
my ($self, $print_config) = @_;
|
||||||
|
|
||||||
|
$self->config->apply_print_config($print_config);
|
||||||
|
$self->_extrusion_axis($self->config->get_extrusion_axis);
|
||||||
|
}
|
||||||
|
|
||||||
sub clone {
|
sub clone {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return (ref $self)->new(
|
return (ref $self)->new(
|
||||||
map { $_ => $self->$_ } (@AXES, 'F'),
|
map { $_ => $self->$_ } (@AXES, 'F', '_extrusion_axis'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +41,11 @@ sub parse {
|
|||||||
$command //= '';
|
$command //= '';
|
||||||
my %args = map { /([A-Z])(.*)/; ($1 => $2) } @args;
|
my %args = map { /([A-Z])(.*)/; ($1 => $2) } @args;
|
||||||
|
|
||||||
|
# convert extrusion axis
|
||||||
|
if (exists $args{ $self->_extrusion_axis }) {
|
||||||
|
$args{E} = $args{ $self->_extrusion_axis };
|
||||||
|
}
|
||||||
|
|
||||||
# check motion
|
# check motion
|
||||||
if ($command =~ /^G[01]$/) {
|
if ($command =~ /^G[01]$/) {
|
||||||
foreach my $axis (@AXES) {
|
foreach my $axis (@AXES) {
|
||||||
|
@ -7,6 +7,11 @@ has 'reader' => (is => 'ro', default => sub { Slic3r::GCode::Reader->new });
|
|||||||
|
|
||||||
use Slic3r::Geometry qw(unscale);
|
use Slic3r::Geometry qw(unscale);
|
||||||
|
|
||||||
|
sub BUILD {
|
||||||
|
my ($self) = @_;
|
||||||
|
$self->reader->apply_print_config($self->config);
|
||||||
|
}
|
||||||
|
|
||||||
sub process_layer {
|
sub process_layer {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($gcode) = @_;
|
my ($gcode) = @_;
|
||||||
|
@ -29,14 +29,7 @@ void
|
|||||||
GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
||||||
{
|
{
|
||||||
this->config.apply(print_config, true);
|
this->config.apply(print_config, true);
|
||||||
|
this->_extrusion_axis = this->config.get_extrusion_axis();
|
||||||
if (FLAVOR_IS(gcfMach3)) {
|
|
||||||
this->_extrusion_axis = "A";
|
|
||||||
} else if (FLAVOR_IS(gcfNoExtrusion)) {
|
|
||||||
this->_extrusion_axis = "";
|
|
||||||
} else {
|
|
||||||
this->_extrusion_axis = this->config.extrusion_axis;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -372,6 +372,17 @@ class GCodeConfig : public virtual StaticPrintConfig
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string get_extrusion_axis() const
|
||||||
|
{
|
||||||
|
if (this->gcode_flavor.value == gcfMach3) {
|
||||||
|
return "A";
|
||||||
|
} else if (this->gcode_flavor.value == gcfNoExtrusion) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return this->extrusion_axis.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class PrintConfig : public GCodeConfig
|
class PrintConfig : public GCodeConfig
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
%code{% THIS->apply(*other, true); %};
|
%code{% THIS->apply(*other, true); %};
|
||||||
std::vector<std::string> get_keys()
|
std::vector<std::string> get_keys()
|
||||||
%code{% THIS->keys(&RETVAL); %};
|
%code{% THIS->keys(&RETVAL); %};
|
||||||
|
std::string get_extrusion_axis();
|
||||||
};
|
};
|
||||||
|
|
||||||
%name{Slic3r::Config::Print} class PrintConfig {
|
%name{Slic3r::Config::Print} class PrintConfig {
|
||||||
@ -71,6 +72,7 @@
|
|||||||
%code{% THIS->apply(*other, true); %};
|
%code{% THIS->apply(*other, true); %};
|
||||||
std::vector<std::string> get_keys()
|
std::vector<std::string> get_keys()
|
||||||
%code{% THIS->keys(&RETVAL); %};
|
%code{% THIS->keys(&RETVAL); %};
|
||||||
|
std::string get_extrusion_axis();
|
||||||
};
|
};
|
||||||
|
|
||||||
%name{Slic3r::Config::PrintRegion} class PrintRegionConfig {
|
%name{Slic3r::Config::PrintRegion} class PrintRegionConfig {
|
||||||
@ -141,6 +143,7 @@
|
|||||||
%code{% THIS->apply(*other, true); %};
|
%code{% THIS->apply(*other, true); %};
|
||||||
std::vector<std::string> get_keys()
|
std::vector<std::string> get_keys()
|
||||||
%code{% THIS->keys(&RETVAL); %};
|
%code{% THIS->keys(&RETVAL); %};
|
||||||
|
std::string get_extrusion_axis();
|
||||||
};
|
};
|
||||||
|
|
||||||
%package{Slic3r::Config};
|
%package{Slic3r::Config};
|
||||||
|
Loading…
Reference in New Issue
Block a user