Merge remote-tracking branch 'origin/master' into ys_search

This commit is contained in:
YuSanka 2020-04-29 14:56:31 +02:00
commit 99d49a74d0
151 changed files with 21552 additions and 3527 deletions
src/libslic3r

View file

@ -39,6 +39,11 @@ void PrintConfigDef::init_common_params()
{
ConfigOptionDef* def;
def = this->add("single_instance", coBool);
def->label = L("Single Instance");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("printer_technology", coEnum);
def->label = L("Printer technology");
def->tooltip = L("Printer technology");
@ -419,18 +424,20 @@ void PrintConfigDef::init_fff_params()
def->cli = "top-fill-pattern|external-fill-pattern|solid-fill-pattern";
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
def->enum_values.push_back("rectilinear");
def->enum_values.push_back("monotonous");
def->enum_values.push_back("concentric");
def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("archimedeanchords");
def->enum_values.push_back("octagramspiral");
def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back(L("Monotonous"));
def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back(L("Hilbert Curve"));
def->enum_labels.push_back(L("Archimedean Chords"));
def->enum_labels.push_back(L("Octagram Spiral"));
// solid_fill_pattern is an obsolete equivalent to top_fill_pattern/bottom_fill_pattern.
def->aliases = { "solid_fill_pattern", "external_fill_pattern" };
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipRectilinear));
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipMonotonous));
def = this->add("bottom_fill_pattern", coEnum);
def->label = L("Bottom fill pattern");
@ -1081,6 +1088,53 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("ironing", coBool);
def->label = L("Enable ironing");
def->tooltip = L("Enable ironing of the top layers with the hot print head for smooth surface");
def->category = L("Ironing");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("ironing_type", coEnum);
def->label = L("Ironingy Type");
def->tooltip = L("Ironingy Type");
def->enum_keys_map = &ConfigOptionEnum<IroningType>::get_enum_values();
def->enum_values.push_back("top");
def->enum_values.push_back("topmost");
def->enum_values.push_back("solid");
def->enum_labels.push_back("All top surfaces");
def->enum_labels.push_back("Topmost surface only");
def->enum_labels.push_back("All solid surfaces");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<IroningType>(IroningType::TopSurfaces));
def = this->add("ironing_flowrate", coPercent);
def->label = L("Flow rate");
def->category = L("Ironing");
def->tooltip = L("Percent of a flow rate relative to object's normal layer height.");
def->sidetext = L("%");
def->ratio_over = "layer_height";
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionPercent(15));
def = this->add("ironing_spacing", coFloat);
def->label = L("Spacing between ironing passes");
def->tooltip = L("Distance between ironing lins");
def->sidetext = L("mm");
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.1));
def = this->add("ironing_speed", coFloat);
def->label = L("Ironing speed");
def->category = L("Speed");
def->tooltip = L("Ironing speed");
def->sidetext = L("mm/s");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(15));
def = this->add("layer_gcode", coString);
def->label = L("After layer change G-code");
def->tooltip = L("This custom code is inserted at every layer change, right after the Z move "
@ -3066,6 +3120,42 @@ DynamicPrintConfig* DynamicPrintConfig::new_from_defaults_keys(const std::vector
return out;
}
double min_object_distance(const ConfigBase &cfg)
{
double ret = 0.;
if (printer_technology(cfg) == ptSLA) ret = 6.;
else {
auto ecr_opt = cfg.option<ConfigOptionFloat>("extruder_clearance_radius");
auto dd_opt = cfg.option<ConfigOptionFloat>("duplicate_distance");
auto co_opt = cfg.option<ConfigOptionBool>("complete_objects");
if (!ecr_opt || !dd_opt || !co_opt) ret = 0.;
else {
// min object distance is max(duplicate_distance, clearance_radius)
ret = (co_opt->value && ecr_opt->value > dd_opt->value) ?
ecr_opt->value : dd_opt->value;
}
}
return ret;
}
PrinterTechnology printer_technology(const ConfigBase &cfg)
{
const ConfigOptionEnum<PrinterTechnology> *opt = cfg.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology");
if (opt) return opt->value;
const ConfigOptionBool *export_opt = cfg.option<ConfigOptionBool>("export_sla");
if (export_opt && export_opt->getBool()) return ptSLA;
export_opt = cfg.option<ConfigOptionBool>("export_gcode");
if (export_opt && export_opt->getBool()) return ptFFF;
return ptUnknown;
}
void DynamicPrintConfig::normalize()
{
if (this->has("extruder")) {
@ -3136,22 +3226,6 @@ std::string DynamicPrintConfig::validate()
}
}
double PrintConfig::min_object_distance() const
{
return PrintConfig::min_object_distance(static_cast<const ConfigBase*>(this));
}
double PrintConfig::min_object_distance(const ConfigBase *config)
{
double extruder_clearance_radius = config->option("extruder_clearance_radius")->getFloat();
double duplicate_distance = config->option("duplicate_distance")->getFloat();
// min object distance is max(duplicate_distance, clearance_radius)
return (config->option("complete_objects")->getBool() && extruder_clearance_radius > duplicate_distance)
? extruder_clearance_radius
: duplicate_distance;
}
//FIXME localize this function.
std::string FullPrintConfig::validate()
{
@ -3561,8 +3635,39 @@ void DynamicPrintAndCLIConfig::handle_legacy(t_config_option_key &opt_key, std::
}
}
static Points to_points(const std::vector<Vec2d> &dpts)
{
Points pts; pts.reserve(dpts.size());
for (auto &v : dpts)
pts.emplace_back( coord_t(scale_(v.x())), coord_t(scale_(v.y())) );
return pts;
}
Points get_bed_shape(const DynamicPrintConfig &config)
{
const auto *bed_shape_opt = config.opt<ConfigOptionPoints>("bed_shape");
if (!bed_shape_opt) {
// Here, it is certain that the bed shape is missing, so an infinite one
// has to be used, but still, the center of bed can be queried
if (auto center_opt = config.opt<ConfigOptionPoint>("center"))
return { scaled(center_opt->value) };
return {};
}
return to_points(bed_shape_opt->values);
}
Points get_bed_shape(const PrintConfig &cfg)
{
return to_points(cfg.bed_shape.values);
}
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.bed_shape.values); }
} // namespace Slic3r
#include <cereal/types/polymorphic.hpp>
CEREAL_REGISTER_TYPE(Slic3r::DynamicPrintConfig)
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::DynamicConfig, Slic3r::DynamicPrintConfig)