Ported a couple more methods to XS
This commit is contained in:
parent
ed75219215
commit
3a9cf91f83
8 changed files with 33 additions and 27 deletions
|
@ -340,15 +340,6 @@ sub validate {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# min object distance is max(duplicate_distance, clearance_radius)
|
|
||||||
sub min_object_distance {
|
|
||||||
my $self = shift;
|
|
||||||
|
|
||||||
return ($self->complete_objects && $self->extruder_clearance_radius > $self->duplicate_distance)
|
|
||||||
? $self->extruder_clearance_radius
|
|
||||||
: $self->duplicate_distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
# CLASS METHODS:
|
# CLASS METHODS:
|
||||||
|
|
||||||
sub write_ini {
|
sub write_ini {
|
||||||
|
|
|
@ -444,22 +444,4 @@ sub expanded_output_filepath {
|
||||||
return $self->placeholder_parser->process($path);
|
return $self->placeholder_parser->process($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
# This method assigns extruders to the volumes having a material
|
|
||||||
# but not having extruders set in the volume config.
|
|
||||||
sub auto_assign_extruders {
|
|
||||||
my ($self, $model_object) = @_;
|
|
||||||
|
|
||||||
# only assign extruders if object has more than one volume
|
|
||||||
return if @{$model_object->volumes} == 1;
|
|
||||||
|
|
||||||
my $extruders = scalar @{ $self->config->nozzle_diameter };
|
|
||||||
foreach my $i (0..$#{$model_object->volumes}) {
|
|
||||||
my $volume = $model_object->volumes->[$i];
|
|
||||||
if ($volume->material_id ne '') {
|
|
||||||
my $extruder_id = $i + 1;
|
|
||||||
$volume->config->set_ifndef('extruder', $extruder_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -824,6 +824,24 @@ Print::has_support_material() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This method assigns extruders to the volumes having a material
|
||||||
|
but not having extruders set in the volume config. */
|
||||||
|
void
|
||||||
|
Print::auto_assign_extruders(ModelObject* model_object) const
|
||||||
|
{
|
||||||
|
// only assign extruders if object has more than one volume
|
||||||
|
if (model_object->volumes.size() < 2) return;
|
||||||
|
|
||||||
|
size_t extruders = this->config.nozzle_diameter.values.size();
|
||||||
|
for (ModelVolumePtrs::const_iterator v = model_object->volumes.begin(); v != model_object->volumes.end(); ++v) {
|
||||||
|
if (!(*v)->material_id().empty()) {
|
||||||
|
size_t extruder_id = (v - model_object->volumes.begin()) + 1;
|
||||||
|
if (!(*v)->config.has("extruder"))
|
||||||
|
(*v)->config.opt<ConfigOptionInt>("extruder", true)->value = extruder_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
#ifdef SLIC3RXS
|
||||||
REGISTER_CLASS(Print, "Print");
|
REGISTER_CLASS(Print, "Print");
|
||||||
|
|
|
@ -206,6 +206,7 @@ class Print
|
||||||
void _simplify_slices(double distance);
|
void _simplify_slices(double distance);
|
||||||
double max_allowed_layer_height() const;
|
double max_allowed_layer_height() const;
|
||||||
bool has_support_material() const;
|
bool has_support_material() const;
|
||||||
|
void auto_assign_extruders(ModelObject* model_object) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clear_regions();
|
void clear_regions();
|
||||||
|
|
|
@ -1095,6 +1095,15 @@ DynamicPrintConfig::normalize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
PrintConfig::min_object_distance() const
|
||||||
|
{
|
||||||
|
// min object distance is max(duplicate_distance, clearance_radius)
|
||||||
|
return (this->complete_objects.value && this->extruder_clearance_radius.value > this->duplicate_distance.value)
|
||||||
|
? this->extruder_clearance_radius.value
|
||||||
|
: this->duplicate_distance.value;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
#ifdef SLIC3RXS
|
||||||
REGISTER_CLASS(DynamicPrintConfig, "Config");
|
REGISTER_CLASS(DynamicPrintConfig, "Config");
|
||||||
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
|
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
|
||||||
|
|
|
@ -576,6 +576,8 @@ class PrintConfig : public GCodeConfig
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
double min_object_distance() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HostConfig : public virtual StaticPrintConfig
|
class HostConfig : public virtual StaticPrintConfig
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
%name{get_keys} std::vector<std::string> keys();
|
%name{get_keys} std::vector<std::string> keys();
|
||||||
std::string get_extrusion_axis();
|
std::string get_extrusion_axis();
|
||||||
%name{setenv} void setenv_();
|
%name{setenv} void setenv_();
|
||||||
|
double min_object_distance();
|
||||||
};
|
};
|
||||||
|
|
||||||
%name{Slic3r::Config::PrintRegion} class PrintRegionConfig {
|
%name{Slic3r::Config::PrintRegion} class PrintRegionConfig {
|
||||||
|
@ -146,6 +147,7 @@
|
||||||
%name{get_keys} std::vector<std::string> keys();
|
%name{get_keys} std::vector<std::string> keys();
|
||||||
std::string get_extrusion_axis();
|
std::string get_extrusion_axis();
|
||||||
%name{setenv} void setenv_();
|
%name{setenv} void setenv_();
|
||||||
|
double min_object_distance();
|
||||||
};
|
};
|
||||||
|
|
||||||
%package{Slic3r::Config};
|
%package{Slic3r::Config};
|
||||||
|
|
|
@ -211,6 +211,7 @@ _constant()
|
||||||
void _simplify_slices(double distance);
|
void _simplify_slices(double distance);
|
||||||
double max_allowed_layer_height() const;
|
double max_allowed_layer_height() const;
|
||||||
bool has_support_material() const;
|
bool has_support_material() const;
|
||||||
|
void auto_assign_extruders(ModelObject* model_object);
|
||||||
|
|
||||||
void add_model_object(ModelObject* model_object, int idx = -1);
|
void add_model_object(ModelObject* model_object, int idx = -1);
|
||||||
bool apply_config(DynamicPrintConfig* config)
|
bool apply_config(DynamicPrintConfig* config)
|
||||||
|
|
Loading…
Add table
Reference in a new issue