Some minor changes to the newly-ported Extruder class
This commit is contained in:
parent
4c330b6c59
commit
24571612c7
@ -149,6 +149,7 @@ sub thread_cleanup {
|
||||
*Slic3r::Geometry::BoundingBoxf3::DESTROY = sub {};
|
||||
*Slic3r::Line::DESTROY = sub {};
|
||||
*Slic3r::Point::DESTROY = sub {};
|
||||
*Slic3r::Pointf::DESTROY = sub {};
|
||||
*Slic3r::Pointf3::DESTROY = sub {};
|
||||
*Slic3r::Polygon::DESTROY = sub {};
|
||||
*Slic3r::Polyline::DESTROY = sub {};
|
||||
|
@ -343,8 +343,8 @@ sub extrude_path {
|
||||
my $path_length = unscale $path->length;
|
||||
{
|
||||
$gcode .= $path->gcode($self->extruder, $e, $F,
|
||||
$self->shift_x - $self->extruder->extruder_offset->[X],
|
||||
$self->shift_y - $self->extruder->extruder_offset->[Y],
|
||||
$self->shift_x - $self->extruder->extruder_offset->x,
|
||||
$self->shift_y - $self->extruder->extruder_offset->y, #,,
|
||||
$self->_extrusion_axis,
|
||||
$self->print_config->gcode_comments ? " ; $description" : "");
|
||||
|
||||
@ -587,8 +587,8 @@ sub _G0_G1 {
|
||||
|
||||
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]; #**
|
||||
($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)) {
|
||||
|
@ -33,6 +33,11 @@ use overload
|
||||
'@{}' => sub { [ $_[0]->x, $_[0]->y ] }, #,
|
||||
'fallback' => 1;
|
||||
|
||||
package Slic3r::Pointf::Ref;
|
||||
our @ISA = 'Slic3r::Pointf';
|
||||
|
||||
sub DESTROY {}
|
||||
|
||||
package Slic3r::Pointf3;
|
||||
use overload
|
||||
'@{}' => sub { [ $_[0]->x, $_[0]->y, $_[0]->z ] }, #,
|
||||
@ -226,9 +231,4 @@ use overload
|
||||
'@{}' => sub { $_[0]->arrayref },
|
||||
'fallback' => 1;
|
||||
|
||||
package Slic3r::Config::Print::Ref;
|
||||
our @ISA = 'Slic3r::Config::Print';
|
||||
|
||||
sub DESTROY {}
|
||||
|
||||
1;
|
||||
|
@ -24,7 +24,7 @@ Extruder::reset()
|
||||
double
|
||||
Extruder::extrude(double dE)
|
||||
{
|
||||
if (this->use_relative_e_distances()) {
|
||||
if (this->config->use_relative_e_distances) {
|
||||
this->E = 0;
|
||||
}
|
||||
|
||||
@ -33,116 +33,94 @@ Extruder::extrude(double dE)
|
||||
return this->E;
|
||||
}
|
||||
|
||||
template <typename Val, class OptType> Val
|
||||
Extruder::get_config(const char *name) const
|
||||
{
|
||||
// TODO: figure out way to avoid static_cast to access hidden const method
|
||||
const ConfigOption *opt = static_cast<const ConfigBase*>(this->config)
|
||||
->option(name);
|
||||
return dynamic_cast<const OptType *>(opt)->get_at(this->id);
|
||||
}
|
||||
|
||||
bool
|
||||
Extruder::use_relative_e_distances() const
|
||||
{
|
||||
// not using get_config because use_relative_e_distances is global
|
||||
// for all extruders
|
||||
|
||||
// TODO: figure out way to avoid static_cast to access hidden const method
|
||||
const ConfigOption *opt = static_cast<const ConfigBase*>(this->config)
|
||||
->option("use_relative_e_distances");
|
||||
return *static_cast<const ConfigOptionBool*>(opt);
|
||||
}
|
||||
|
||||
Pointf
|
||||
Extruder::extruder_offset() const
|
||||
{
|
||||
return get_config<Pointf, ConfigOptionPoints>("extruder_offset");
|
||||
return this->config->extruder_offset.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::nozzle_diameter() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("nozzle_diameter");
|
||||
return this->config->nozzle_diameter.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::filament_diameter() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("filament_diameter");
|
||||
return this->config->filament_diameter.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::extrusion_multiplier() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("extrusion_multiplier");
|
||||
return this->config->extrusion_multiplier.get_at(this->id);
|
||||
}
|
||||
|
||||
int
|
||||
Extruder::temperature() const
|
||||
{
|
||||
return get_config<int, ConfigOptionInts>("temperature");
|
||||
return this->config->temperature.get_at(this->id);
|
||||
}
|
||||
|
||||
int
|
||||
Extruder::first_layer_temperature() const
|
||||
{
|
||||
return get_config<int, ConfigOptionInts>("first_layer_temperature");
|
||||
return this->config->first_layer_temperature.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_length() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_length");
|
||||
return this->config->retract_length.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_lift() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_lift");
|
||||
return this->config->retract_lift.get_at(this->id);
|
||||
}
|
||||
|
||||
int
|
||||
Extruder::retract_speed() const
|
||||
{
|
||||
return get_config<int, ConfigOptionInts>("retract_speed");
|
||||
return this->config->retract_speed.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_restart_extra() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_restart_extra");
|
||||
return this->config->retract_restart_extra.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_before_travel() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_before_travel");
|
||||
return this->config->retract_before_travel.get_at(this->id);
|
||||
}
|
||||
|
||||
bool
|
||||
Extruder::retract_layer_change() const
|
||||
{
|
||||
return get_config<bool, ConfigOptionBools>("retract_layer_change");
|
||||
return this->config->retract_layer_change.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_length_toolchange() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_length_toolchange");
|
||||
return this->config->retract_length_toolchange.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_restart_extra_toolchange() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>(
|
||||
"retract_restart_extra_toolchange");
|
||||
return this->config->retract_restart_extra_toolchange.get_at(this->id);
|
||||
}
|
||||
|
||||
bool
|
||||
Extruder::wipe() const
|
||||
{
|
||||
return get_config<bool, ConfigOptionBools>("wipe");
|
||||
return this->config->wipe.get_at(this->id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@ class Extruder
|
||||
double extrude(double dE);
|
||||
|
||||
|
||||
bool use_relative_e_distances() const;
|
||||
Pointf extruder_offset() const;
|
||||
double nozzle_diameter() const;
|
||||
double filament_diameter() const;
|
||||
@ -40,13 +39,6 @@ class Extruder
|
||||
double restart_extra;
|
||||
|
||||
PrintConfig *config;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// get value from a ConfigOptionVector subtype, indexed by extruder id
|
||||
template <typename Val, class OptType>
|
||||
Val get_config(const char *name) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
%name{Slic3r::Extruder} class Extruder {
|
||||
Extruder(int id, PrintConfig *config);
|
||||
|
||||
~Extruder();
|
||||
void reset();
|
||||
double extrude(double dE);
|
||||
@ -15,7 +14,6 @@
|
||||
int id() const
|
||||
%code%{ RETVAL = THIS->id; %};
|
||||
|
||||
|
||||
double E() const
|
||||
%code%{ RETVAL = THIS->E; %};
|
||||
double set_E(double val) const
|
||||
|
Loading…
Reference in New Issue
Block a user