ENH: change some params to nullable
jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ifd91da26d089c78e2d5036e145b7f4404535b7a5
This commit is contained in:
parent
ab81baee92
commit
7d4d5f2c9b
|
@ -1776,10 +1776,10 @@ int CLI::run(int argc, char **argv)
|
|||
old_height_to_lid = config.opt_float("extruder_clearance_height_to_lid");
|
||||
if (config.option<ConfigOptionFloat>("extruder_clearance_max_radius"))
|
||||
old_max_radius = config.opt_float("extruder_clearance_max_radius");
|
||||
if (config.option<ConfigOptionFloats>("max_layer_height"))
|
||||
old_max_layer_height = config.option<ConfigOptionFloats>("max_layer_height")->values;
|
||||
if (config.option<ConfigOptionFloats>("min_layer_height"))
|
||||
old_min_layer_height = config.option<ConfigOptionFloats>("min_layer_height")->values;
|
||||
if (config.option<ConfigOptionFloatsNullable>("max_layer_height"))
|
||||
old_max_layer_height = config.option<ConfigOptionFloatsNullable>("max_layer_height")->values;
|
||||
if (config.option<ConfigOptionFloatsNullable>("min_layer_height"))
|
||||
old_min_layer_height = config.option<ConfigOptionFloatsNullable>("min_layer_height")->values;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("old printable size from 3mf: {%1%, %2%, %3%}")%old_printable_width %old_printable_depth %old_printable_height;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("old extruder_clearance_height_to_rod %1%, extruder_clearance_height_to_lid %2%, extruder_clearance_max_radius %3%}")%old_height_to_rod %old_height_to_lid %old_max_radius;
|
||||
}
|
||||
|
@ -3161,7 +3161,7 @@ int CLI::run(int argc, char **argv)
|
|||
}
|
||||
|
||||
size_t nozzle_nums = 1;
|
||||
auto opt_nozzle_diameters = m_print_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
auto opt_nozzle_diameters = m_print_config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
if (opt_nozzle_diameters != nullptr) {
|
||||
nozzle_nums = opt_nozzle_diameters->values.size();
|
||||
}
|
||||
|
@ -5893,7 +5893,7 @@ int CLI::run(int argc, char **argv)
|
|||
//auto* filament_types = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_type"));
|
||||
//const ConfigOptionStrings* filament_color = dynamic_cast<const ConfigOptionStrings *>(m_print_config.option("filament_colour"));
|
||||
auto* filament_id = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_ids"));
|
||||
const ConfigOptionFloats* nozzle_diameter_option = dynamic_cast<const ConfigOptionFloats *>(m_print_config.option("nozzle_diameter"));
|
||||
const ConfigOptionFloatsNullable* nozzle_diameter_option = dynamic_cast<const ConfigOptionFloatsNullable *>(m_print_config.option("nozzle_diameter"));
|
||||
std::string nozzle_diameter_str;
|
||||
if (nozzle_diameter_option)
|
||||
nozzle_diameter_str = nozzle_diameter_option->serialize();
|
||||
|
@ -6465,7 +6465,7 @@ int CLI::run(int argc, char **argv)
|
|||
plate_bbox->bed_type = bed_type_to_gcode_string(plate_bed_type);
|
||||
}
|
||||
// get nozzle diameter
|
||||
auto opt_nozzle_diameters = m_print_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
auto opt_nozzle_diameters = m_print_config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
if (opt_nozzle_diameters != nullptr)
|
||||
plate_bbox->nozzle_diameter = float(opt_nozzle_diameters->get_at(plate_bbox->first_extruder));
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace Slic3r {
|
|||
float CalibPressureAdvance::find_optimal_PA_speed(const DynamicPrintConfig &config, double line_width, double layer_height, int extruder_id, int filament_idx)
|
||||
{
|
||||
const double general_suggested_min_speed = 100.0;
|
||||
double filament_max_volumetric_speed = config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(filament_idx);
|
||||
Flow pattern_line = Flow(line_width, layer_height, config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(extruder_id));
|
||||
double filament_max_volumetric_speed = config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed")->get_at(filament_idx);
|
||||
Flow pattern_line = Flow(line_width, layer_height, config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->get_at(extruder_id));
|
||||
auto pa_speed = std::min(std::max(general_suggested_min_speed, config.option<ConfigOptionFloatsNullable>("outer_wall_speed")->get_at(extruder_id)),
|
||||
filament_max_volumetric_speed / pattern_line.mm3_per_mm());
|
||||
|
||||
|
@ -206,7 +206,7 @@ double CalibPressureAdvance::get_distance(Vec2d from, Vec2d to) const { return s
|
|||
|
||||
std::string CalibPressureAdvance::draw_line(GCodeWriter &writer, Vec2d to_pt, double line_width, double layer_height, double speed, const std::string &comment)
|
||||
{
|
||||
const double e_per_mm = CalibPressureAdvance::e_per_mm(line_width, layer_height, m_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0),
|
||||
const double e_per_mm = CalibPressureAdvance::e_per_mm(line_width, layer_height, m_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->get_at(0),
|
||||
m_config.option<ConfigOptionFloats>("filament_diameter")->get_at(0),
|
||||
m_config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0));
|
||||
|
||||
|
@ -553,7 +553,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi
|
|||
if (i == 1) {
|
||||
gcode << m_writer.set_pressure_advance(m_params.start);
|
||||
|
||||
double number_e_per_mm = e_per_mm(line_width(), height_layer(), m_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0),
|
||||
double number_e_per_mm = e_per_mm(line_width(), height_layer(), m_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->get_at(0),
|
||||
m_config.option<ConfigOptionFloats>("filament_diameter")->get_at(0),
|
||||
m_config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0));
|
||||
|
||||
|
|
|
@ -662,9 +662,10 @@ public:
|
|||
|
||||
// Is this option overridden by another option?
|
||||
// An option overrides another option if it is not nil and not equal.
|
||||
// assume lhs is not nullable even it is nullable
|
||||
bool overriden_by(const ConfigOption *rhs) const override {
|
||||
if (this->nullable())
|
||||
throw ConfigurationError("Cannot override a nullable ConfigOption.");
|
||||
/*if (this->nullable())
|
||||
throw ConfigurationError("Cannot override a nullable ConfigOption.");*/
|
||||
if (rhs->type() != this->type())
|
||||
throw ConfigurationError("ConfigOptionVector.overriden_by() applied to different types.");
|
||||
auto rhs_vec = static_cast<const ConfigOptionVector<T>*>(rhs);
|
||||
|
@ -682,9 +683,10 @@ public:
|
|||
return false;
|
||||
}
|
||||
// Apply an override option, possibly a nullable one.
|
||||
// assume lhs is not nullable even it is nullable
|
||||
bool apply_override(const ConfigOption *rhs) override {
|
||||
if (this->nullable())
|
||||
throw ConfigurationError("Cannot override a nullable ConfigOption.");
|
||||
//if (this->nullable())
|
||||
// throw ConfigurationError("Cannot override a nullable ConfigOption.");
|
||||
if (rhs->type() != this->type())
|
||||
throw ConfigurationError("ConfigOptionVector.apply_override() applied to different types.");
|
||||
auto rhs_vec = static_cast<const ConfigOptionVector<T>*>(rhs);
|
||||
|
@ -2513,6 +2515,8 @@ public:
|
|||
int opt_int(const t_config_option_key &opt_key) const { return dynamic_cast<const ConfigOptionInt*>(this->option(opt_key))->value; }
|
||||
int& opt_int(const t_config_option_key &opt_key, unsigned int idx) { return this->option<ConfigOptionInts>(opt_key)->get_at(idx); }
|
||||
int opt_int(const t_config_option_key &opt_key, unsigned int idx) const { return dynamic_cast<const ConfigOptionInts*>(this->option(opt_key))->get_at(idx); }
|
||||
int& opt_int_nullable(const t_config_option_key &opt_key, unsigned int idx) { return this->option<ConfigOptionIntsNullable>(opt_key)->get_at(idx);}
|
||||
const int & opt_int_nullable(const t_config_option_key &opt_key, unsigned int idx) const { return dynamic_cast<const ConfigOptionIntsNullable*>(this->option(opt_key))->get_at(idx);}
|
||||
|
||||
// In ConfigManipulation::toggle_print_fff_options, it is called on option with type ConfigOptionEnumGeneric* and also ConfigOptionEnum*.
|
||||
// Thus the virtual method getInt() is used to retrieve the enum value.
|
||||
|
@ -2520,9 +2524,13 @@ public:
|
|||
ENUM opt_enum(const t_config_option_key &opt_key) const { return static_cast<ENUM>(this->option(opt_key)->getInt()); }
|
||||
// BBS
|
||||
int opt_enum(const t_config_option_key &opt_key, unsigned int idx) const { return dynamic_cast<const ConfigOptionEnumsGeneric*>(this->option(opt_key))->get_at(idx); }
|
||||
int opt_enum_nullable(const t_config_option_key &opt_key, unsigned int idx) const { return dynamic_cast<const ConfigOptionEnumsGenericNullable*>(this->option(opt_key))->get_at(idx); }
|
||||
|
||||
|
||||
bool opt_bool(const t_config_option_key &opt_key) const { return this->option<ConfigOptionBool>(opt_key)->value != 0; }
|
||||
bool opt_bool(const t_config_option_key &opt_key, unsigned int idx) const;
|
||||
bool opt_bool_nullable(const t_config_option_key &opt_key, unsigned int idx) const { return dynamic_cast<const ConfigOptionBoolsNullable*>(this->option(opt_key))->get_at(idx);}
|
||||
|
||||
|
||||
// Command line processing
|
||||
bool read_cli(int argc, const char* const argv[], t_config_option_keys* extra, t_config_option_keys* keys = nullptr);
|
||||
|
|
|
@ -100,7 +100,7 @@ double Flow::extrusion_width(const std::string& opt_key, const ConfigOptionFloat
|
|||
|
||||
if (opt->value == 0.) {
|
||||
// If user left option to 0, calculate a sane default width.
|
||||
auto opt_nozzle_diameters = config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
auto opt_nozzle_diameters = config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
if (opt_nozzle_diameters == nullptr)
|
||||
throw_on_missing_variable(opt_key, "nozzle_diameter");
|
||||
return auto_extrusion_width(opt_key_to_flow_role(opt_key), float(opt_nozzle_diameters->get_at(first_printing_extruder)));
|
||||
|
|
|
@ -1966,8 +1966,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
m_placeholder_parser.set("retraction_distance_when_cut", m_config.retraction_distances_when_cut.get_at(extruder_id));
|
||||
m_placeholder_parser.set("long_retraction_when_cut", m_config.long_retractions_when_cut.get_at(extruder_id));
|
||||
|
||||
m_placeholder_parser.set("retraction_distances_when_cut", new ConfigOptionFloats(m_config.retraction_distances_when_cut));
|
||||
m_placeholder_parser.set("long_retractions_when_cut",new ConfigOptionBools(m_config.long_retractions_when_cut));
|
||||
m_placeholder_parser.set("retraction_distances_when_cut", new ConfigOptionFloatsNullable(m_config.retraction_distances_when_cut));
|
||||
m_placeholder_parser.set("long_retractions_when_cut",new ConfigOptionBoolsNullable(m_config.long_retractions_when_cut));
|
||||
//Set variable for total layer count so it can be used in custom gcode.
|
||||
m_placeholder_parser.set("total_layer_count", m_layer_count);
|
||||
// Useful for sequential prints.
|
||||
|
@ -2062,7 +2062,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
|
||||
//support variables `first_layer_temperature` and `first_layer_bed_temperature`
|
||||
m_placeholder_parser.set("first_layer_bed_temperature", new ConfigOptionInts(*first_bed_temp_opt));
|
||||
m_placeholder_parser.set("first_layer_temperature", new ConfigOptionInts(m_config.nozzle_temperature_initial_layer));
|
||||
m_placeholder_parser.set("first_layer_temperature", new ConfigOptionIntsNullable(m_config.nozzle_temperature_initial_layer));
|
||||
m_placeholder_parser.set("max_print_height", new ConfigOptionInt(m_config.printable_height));
|
||||
m_placeholder_parser.set("z_offset", new ConfigOptionFloat(0.0f));
|
||||
m_placeholder_parser.set("plate_name", new ConfigOptionString(print.get_plate_name()));
|
||||
|
@ -2075,7 +2075,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
m_placeholder_parser.set("during_print_exhaust_fan_speed_num",new ConfigOptionInts(during_print_exhaust_fan_speed_num));
|
||||
//BBS: calculate the volumetric speed of outer wall. Ignore pre-object setting and multi-filament, and just use the default setting
|
||||
{
|
||||
float filament_max_volumetric_speed = m_config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(initial_non_support_extruder_id);
|
||||
float filament_max_volumetric_speed = m_config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed")->get_at(initial_non_support_extruder_id);
|
||||
float outer_wall_line_width = print.default_region_config().outer_wall_line_width.value;
|
||||
if (outer_wall_line_width == 0.0) {
|
||||
float default_line_width = print.default_object_config().line_width.value;
|
||||
|
@ -2185,7 +2185,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
}
|
||||
|
||||
CalibPressureAdvanceLine pa_test(this);
|
||||
double filament_max_volumetric_speed = m_config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(initial_extruder_id);
|
||||
double filament_max_volumetric_speed = m_config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed")->get_at(initial_extruder_id);
|
||||
Flow pattern_line = Flow(pa_test.line_width(), 0.2, m_config.nozzle_diameter.get_at(0));
|
||||
auto fast_speed = std::min(print.default_region_config().outer_wall_speed.get_at(cur_extruder_index()), filament_max_volumetric_speed / pattern_line.mm3_per_mm());
|
||||
auto slow_speed = fast_speed / 4; /*std::max(20.0, fast_speed / 10.0);*/
|
||||
|
@ -3197,16 +3197,16 @@ GCode::LayerResult GCode::process_layer(
|
|||
}
|
||||
else if (print.calib_mode() == CalibMode::Calib_Vol_speed_Tower) {
|
||||
auto _speed = print.calib_params().start + print_z * print.calib_params().step;
|
||||
m_calib_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(std::round(_speed)));
|
||||
m_calib_config.set_key_value("outer_wall_speed", new ConfigOptionFloatsNullable({ std::round(_speed) }));
|
||||
}
|
||||
else if (print.calib_mode() == CalibMode::Calib_VFA_Tower) {
|
||||
auto _speed = print.calib_params().start + std::floor(print_z / 5.0) * print.calib_params().step;
|
||||
m_calib_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(std::round(_speed)));
|
||||
m_calib_config.set_key_value("outer_wall_speed", new ConfigOptionFloatsNullable({ std::round(_speed) }));
|
||||
}
|
||||
else if (print.calib_mode() == CalibMode::Calib_Retraction_tower) {
|
||||
auto _length = print.calib_params().start + std::floor(std::max(0.0, print_z - 0.4)) * print.calib_params().step;
|
||||
DynamicConfig _cfg;
|
||||
_cfg.set_key_value("retraction_length", new ConfigOptionFloats{_length});
|
||||
_cfg.set_key_value("retraction_length", new ConfigOptionFloatsNullable{_length});
|
||||
writer().config.apply(_cfg);
|
||||
sprintf(buf, "; Calib_Retraction_tower: Z_HEIGHT: %g, length:%g\n", print_z, _length);
|
||||
gcode += buf;
|
||||
|
|
|
@ -86,12 +86,24 @@ static void set_option_value(ConfigOptionFloats& option, size_t id, float value)
|
|||
option.values[id] = static_cast<double>(value);
|
||||
};
|
||||
|
||||
static void set_option_value(ConfigOptionFloatsNullable& option, size_t id, float value)
|
||||
{
|
||||
if (id < option.values.size())
|
||||
option.values[id] = static_cast<double>(value);
|
||||
};
|
||||
|
||||
static float get_option_value(const ConfigOptionFloats& option, size_t id)
|
||||
{
|
||||
return option.values.empty() ? 0.0f :
|
||||
((id < option.values.size()) ? static_cast<float>(option.values[id]) : static_cast<float>(option.values.back()));
|
||||
}
|
||||
|
||||
static float get_option_value(const ConfigOptionFloatsNullable& option, size_t id)
|
||||
{
|
||||
return option.values.empty() ? 0.0f :
|
||||
((id < option.values.size()) ? static_cast<float>(option.values[id]) : static_cast<float>(option.values.back()));
|
||||
}
|
||||
|
||||
static float estimated_acceleration_distance(float initial_rate, float target_rate, float acceleration)
|
||||
{
|
||||
return (acceleration == 0.0f) ? 0.0f : (sqr(target_rate) - sqr(initial_rate)) / (2.0f * acceleration);
|
||||
|
@ -1319,76 +1331,76 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
|||
m_time_processor.extruder_change_times = static_cast<float>(machine_switch_extruder_time->value);
|
||||
|
||||
if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware || m_flavor == gcfKlipper) {
|
||||
const ConfigOptionFloats* machine_max_acceleration_x = config.option<ConfigOptionFloats>("machine_max_acceleration_x");
|
||||
const ConfigOptionFloatsNullable* machine_max_acceleration_x = config.option<ConfigOptionFloatsNullable>("machine_max_acceleration_x");
|
||||
if (machine_max_acceleration_x != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_x.values = machine_max_acceleration_x->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_acceleration_y = config.option<ConfigOptionFloats>("machine_max_acceleration_y");
|
||||
const ConfigOptionFloatsNullable* machine_max_acceleration_y = config.option<ConfigOptionFloatsNullable>("machine_max_acceleration_y");
|
||||
if (machine_max_acceleration_y != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_y.values = machine_max_acceleration_y->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_acceleration_z = config.option<ConfigOptionFloats>("machine_max_acceleration_z");
|
||||
const ConfigOptionFloatsNullable* machine_max_acceleration_z = config.option<ConfigOptionFloatsNullable>("machine_max_acceleration_z");
|
||||
if (machine_max_acceleration_z != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_z.values = machine_max_acceleration_z->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_acceleration_e = config.option<ConfigOptionFloats>("machine_max_acceleration_e");
|
||||
const ConfigOptionFloatsNullable* machine_max_acceleration_e = config.option<ConfigOptionFloatsNullable>("machine_max_acceleration_e");
|
||||
if (machine_max_acceleration_e != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_e.values = machine_max_acceleration_e->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_speed_x = config.option<ConfigOptionFloats>("machine_max_speed_x");
|
||||
const ConfigOptionFloatsNullable* machine_max_speed_x = config.option<ConfigOptionFloatsNullable>("machine_max_speed_x");
|
||||
if (machine_max_speed_x != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_speed_x.values = machine_max_speed_x->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_speed_y = config.option<ConfigOptionFloats>("machine_max_speed_y");
|
||||
const ConfigOptionFloatsNullable* machine_max_speed_y = config.option<ConfigOptionFloatsNullable>("machine_max_speed_y");
|
||||
if (machine_max_speed_y != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_speed_y.values = machine_max_speed_y->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_speed_z = config.option<ConfigOptionFloats>("machine_max_speed_z");
|
||||
const ConfigOptionFloatsNullable* machine_max_speed_z = config.option<ConfigOptionFloatsNullable>("machine_max_speed_z");
|
||||
if (machine_max_speed_z != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_speed_z.values = machine_max_speed_z->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_speed_e = config.option<ConfigOptionFloats>("machine_max_speed_e");
|
||||
const ConfigOptionFloatsNullable* machine_max_speed_e = config.option<ConfigOptionFloatsNullable>("machine_max_speed_e");
|
||||
if (machine_max_speed_e != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_speed_e.values = machine_max_speed_e->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_jerk_x = config.option<ConfigOptionFloats>("machine_max_jerk_x");
|
||||
const ConfigOptionFloatsNullable* machine_max_jerk_x = config.option<ConfigOptionFloatsNullable>("machine_max_jerk_x");
|
||||
if (machine_max_jerk_x != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_jerk_x.values = machine_max_jerk_x->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_jerk_y = config.option<ConfigOptionFloats>("machine_max_jerk_y");
|
||||
const ConfigOptionFloatsNullable* machine_max_jerk_y = config.option<ConfigOptionFloatsNullable>("machine_max_jerk_y");
|
||||
if (machine_max_jerk_y != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_jerk_y.values = machine_max_jerk_y->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_jerk_z = config.option<ConfigOptionFloats>("machine_max_jerkz");
|
||||
const ConfigOptionFloatsNullable* machine_max_jerk_z = config.option<ConfigOptionFloatsNullable>("machine_max_jerkz");
|
||||
if (machine_max_jerk_z != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_jerk_z.values = machine_max_jerk_z->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_jerk_e = config.option<ConfigOptionFloats>("machine_max_jerk_e");
|
||||
const ConfigOptionFloatsNullable* machine_max_jerk_e = config.option<ConfigOptionFloatsNullable>("machine_max_jerk_e");
|
||||
if (machine_max_jerk_e != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_jerk_e.values = machine_max_jerk_e->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_acceleration_extruding = config.option<ConfigOptionFloats>("machine_max_acceleration_extruding");
|
||||
const ConfigOptionFloatsNullable* machine_max_acceleration_extruding = config.option<ConfigOptionFloatsNullable>("machine_max_acceleration_extruding");
|
||||
if (machine_max_acceleration_extruding != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_extruding.values = machine_max_acceleration_extruding->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_acceleration_retracting = config.option<ConfigOptionFloats>("machine_max_acceleration_retracting");
|
||||
const ConfigOptionFloatsNullable* machine_max_acceleration_retracting = config.option<ConfigOptionFloatsNullable>("machine_max_acceleration_retracting");
|
||||
if (machine_max_acceleration_retracting != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_retracting.values = machine_max_acceleration_retracting->values;
|
||||
|
||||
|
||||
// Legacy Marlin does not have separate travel acceleration, it uses the 'extruding' value instead.
|
||||
const ConfigOptionFloats* machine_max_acceleration_travel = config.option<ConfigOptionFloats>(m_flavor == gcfMarlinLegacy
|
||||
const ConfigOptionFloatsNullable* machine_max_acceleration_travel = config.option<ConfigOptionFloatsNullable>(m_flavor == gcfMarlinLegacy
|
||||
? "machine_max_acceleration_extruding"
|
||||
: "machine_max_acceleration_travel");
|
||||
if (machine_max_acceleration_travel != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_travel.values = machine_max_acceleration_travel->values;
|
||||
|
||||
|
||||
const ConfigOptionFloats* machine_min_extruding_rate = config.option<ConfigOptionFloats>("machine_min_extruding_rate");
|
||||
const ConfigOptionFloatsNullable* machine_min_extruding_rate = config.option<ConfigOptionFloatsNullable>("machine_min_extruding_rate");
|
||||
if (machine_min_extruding_rate != nullptr)
|
||||
m_time_processor.machine_limits.machine_min_extruding_rate.values = machine_min_extruding_rate->values;
|
||||
|
||||
const ConfigOptionFloats* machine_min_travel_rate = config.option<ConfigOptionFloats>("machine_min_travel_rate");
|
||||
const ConfigOptionFloatsNullable* machine_min_travel_rate = config.option<ConfigOptionFloatsNullable>("machine_min_travel_rate");
|
||||
if (machine_min_travel_rate != nullptr)
|
||||
m_time_processor.machine_limits.machine_min_travel_rate.values = machine_min_travel_rate->values;
|
||||
}
|
||||
|
|
|
@ -3589,7 +3589,7 @@ void Model::setExtruderParams(const DynamicPrintConfig& config, int extruders_co
|
|||
matName = config.opt_string("filament_type", i);
|
||||
}
|
||||
if (config.has("nozzle_temperature")) {
|
||||
endTemp = config.opt_int("nozzle_temperature", i);
|
||||
endTemp = config.opt_int_nullable("nozzle_temperature", i);
|
||||
}
|
||||
|
||||
// FIXME: curr_bed_type is now a plate config rather than a global config.
|
||||
|
@ -3792,7 +3792,7 @@ double Model::findMaxSpeed(const ModelObject* object) {
|
|||
if (objectKey == "outer_wall_speed")
|
||||
externalPerimeterSpeedObj = object->config.get().opt_float_nullable(objectKey, 0);
|
||||
if (objectKey == "small_perimeter_speed")
|
||||
smallPerimeterSpeedObj = object->config.opt_float(objectKey);
|
||||
smallPerimeterSpeedObj = object->config.get().opt_float_nullable(objectKey,0);
|
||||
}
|
||||
objMaxSpeed = std::max(perimeterSpeedObj, std::max(externalPerimeterSpeedObj, std::max(infillSpeedObj, std::max(solidInfillSpeedObj, std::max(topSolidInfillSpeedObj, std::max(supportSpeedObj, std::max(smallPerimeterSpeedObj,objMaxSpeed)))))));
|
||||
if (objMaxSpeed <= 0) objMaxSpeed = 250.;
|
||||
|
|
|
@ -136,9 +136,9 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r::
|
|||
}
|
||||
|
||||
if (config.has("nozzle_temperature")) //get the print temperature
|
||||
ap.print_temp = config.opt_int("nozzle_temperature", ap.extrude_ids.front() - 1);
|
||||
ap.print_temp = config.opt_int_nullable("nozzle_temperature", ap.extrude_ids.front() - 1);
|
||||
if (config.has("nozzle_temperature_initial_layer")) //get the nozzle_temperature_initial_layer
|
||||
ap.first_print_temp = config.opt_int("nozzle_temperature_initial_layer", ap.extrude_ids.front() - 1);
|
||||
ap.first_print_temp = config.opt_int_nullable("nozzle_temperature_initial_layer", ap.extrude_ids.front() - 1);
|
||||
|
||||
if (config.has("temperature_vitrification")) {
|
||||
ap.vitrify_temp = config.opt_int("temperature_vitrification", ap.extrude_ids.front() - 1);
|
||||
|
|
|
@ -664,7 +664,7 @@ bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const Pre
|
|||
config.set_key_value("printer_preset", new ConfigOptionString(active_printer.preset.name));
|
||||
const ConfigOption *opt = active_printer.preset.config.option("nozzle_diameter");
|
||||
if (opt)
|
||||
config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloats*>(opt)->values.size()));
|
||||
config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloatsNullable*>(opt)->values.size()));
|
||||
return is_compatible_with_printer(preset, active_printer, &config);
|
||||
}
|
||||
|
||||
|
@ -2693,7 +2693,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
|
|||
config.set_key_value("printer_preset", new ConfigOptionString(active_printer.preset.name));
|
||||
const ConfigOption *opt = active_printer.preset.config.option("nozzle_diameter");
|
||||
if (opt)
|
||||
config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloats*>(opt)->values.size()));
|
||||
config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloatsNullable*>(opt)->values.size()));
|
||||
bool some_compatible = false;
|
||||
for (size_t idx_preset = m_num_default_presets; idx_preset < m_presets.size(); ++ idx_preset) {
|
||||
bool selected = idx_preset == m_idx_selected;
|
||||
|
|
|
@ -1871,7 +1871,7 @@ void PresetBundle::set_calibrate_printer(std::string name)
|
|||
DynamicPrintConfig config;
|
||||
config.set_key_value("printer_preset", new ConfigOptionString(active_printer.preset.name));
|
||||
const ConfigOption *opt = active_printer.preset.config.option("nozzle_diameter");
|
||||
if (opt) config.set_key_value("num_extruders", new ConfigOptionInt((int) static_cast<const ConfigOptionFloats *>(opt)->values.size()));
|
||||
if (opt) config.set_key_value("num_extruders", new ConfigOptionInt((int) static_cast<const ConfigOptionFloatsNullable *>(opt)->values.size()));
|
||||
calibrate_filaments.clear();
|
||||
for (size_t i = filaments.num_default_presets(); i < filaments.size(); ++i) {
|
||||
const Preset & preset = filaments.m_presets[i];
|
||||
|
@ -2010,7 +2010,7 @@ int PresetBundle::get_printer_extruder_count()
|
|||
{
|
||||
Preset& printer_preset = this->printers.get_edited_preset();
|
||||
|
||||
int count = printer_preset.config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
int count = printer_preset.config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -2067,7 +2067,7 @@ DynamicPrintConfig PresetBundle::full_fff_config(bool apply_extruder, std::vecto
|
|||
filament_maps.resize(num_filaments, 1);
|
||||
}
|
||||
|
||||
auto* extruder_diameter = dynamic_cast<const ConfigOptionFloats*>(out.option("nozzle_diameter"));
|
||||
auto* extruder_diameter = dynamic_cast<const ConfigOptionFloatsNullable*>(out.option("nozzle_diameter"));
|
||||
// Collect the "compatible_printers_condition" and "inherits" values over all presets (print, filaments, printers) into a single vector.
|
||||
std::vector<std::string> compatible_printers_condition;
|
||||
std::vector<std::string> compatible_prints_condition;
|
||||
|
@ -2501,7 +2501,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||
std::vector<int> filament_self_indice = std::move(config.option<ConfigOptionInts>("filament_self_index", true)->values);
|
||||
if (config.option("extruder_variant_list")) {
|
||||
//3mf support multiple extruder logic
|
||||
size_t extruder_count = config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
size_t extruder_count = config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
extruder_variant_count = config.option<ConfigOptionStrings>("filament_extruder_variant", true)->size();
|
||||
if ((extruder_variant_count != filament_self_indice.size())
|
||||
|| (extruder_variant_count < num_filaments)) {
|
||||
|
|
|
@ -1624,7 +1624,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->min = 0;
|
||||
def->max = 70;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 2. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 2. });
|
||||
|
||||
def = this->add("filament_minimal_purge_on_wipe_tower", coFloats);
|
||||
def->label = L("Minimal purge on wipe tower");
|
||||
|
@ -1881,7 +1882,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = "mm/s²";
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats{500});
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{500});
|
||||
|
||||
def = this->add("outer_wall_acceleration", coFloats);
|
||||
def->label = L("Outer wall");
|
||||
|
@ -1898,7 +1900,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = "mm/s²";
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats{0});
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{0});
|
||||
|
||||
def = this->add("sparse_infill_acceleration", coFloatsOrPercents);
|
||||
def->label = L("Sparse infill");
|
||||
|
@ -1907,7 +1910,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->ratio_over = "default_acceleration";
|
||||
def->set_default_value(new ConfigOptionFloatsOrPercents{FloatOrPercent(100, true)});
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)});
|
||||
|
||||
def = this->add("initial_layer_acceleration", coFloats);
|
||||
def->label = L("Initial layer");
|
||||
|
@ -1915,6 +1919,7 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = "mm/s²";
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{300});
|
||||
|
||||
def = this->add("accel_to_decel_enable", coBool);
|
||||
|
@ -2038,7 +2043,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = "°C";
|
||||
def->min = 0;
|
||||
def->max = max_temp;
|
||||
def->set_default_value(new ConfigOptionInts { 200 });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionIntsNullable { 200 });
|
||||
|
||||
def = this->add("full_fan_speed_layer", coInts);
|
||||
def->label = L("Full fan speed at layer");
|
||||
|
@ -2553,7 +2559,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm/s");
|
||||
def->min = 0;
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloats(axis.max_feedrate));
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable(axis.max_feedrate));
|
||||
// Add the machine acceleration limits for XYZE axes (M201)
|
||||
def = this->add("machine_max_acceleration_" + axis.name, coFloats);
|
||||
def->full_label = (boost::format("Maximum acceleration %1%") % axis_upper).str();
|
||||
|
@ -2571,7 +2578,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = "mm/s²";
|
||||
def->min = 0;
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloats(axis.max_acceleration));
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable(axis.max_acceleration));
|
||||
// Add the machine jerk limits for XYZE axes (M205)
|
||||
def = this->add("machine_max_jerk_" + axis.name, coFloats);
|
||||
def->full_label = (boost::format("Maximum jerk %1%") % axis_upper).str();
|
||||
|
@ -2589,7 +2597,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm/s");
|
||||
def->min = 0;
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloats(axis.max_jerk));
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable(axis.max_jerk));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2601,7 +2610,7 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm/s");
|
||||
def->min = 0;
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloats{ 0., 0. });
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{ 0., 0. });
|
||||
|
||||
// M205 T... [mm/sec]
|
||||
def = this->add("machine_min_travel_rate", coFloats);
|
||||
|
@ -2611,7 +2620,7 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm/s");
|
||||
def->min = 0;
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloats{ 0., 0. });
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{ 0., 0. });
|
||||
|
||||
// M204 P... [mm/sec^2]
|
||||
def = this->add("machine_max_acceleration_extruding", coFloats);
|
||||
|
@ -2624,7 +2633,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->min = 0;
|
||||
def->readonly = false;
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{ 1500., 1250. });
|
||||
|
||||
|
||||
// M204 R... [mm/sec^2]
|
||||
|
@ -2636,7 +2646,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->min = 0;
|
||||
def->readonly = false;
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{ 1500., 1250. });
|
||||
|
||||
// M204 T... [mm/sec^2]
|
||||
def = this->add("machine_max_acceleration_travel", coFloats);
|
||||
|
@ -2647,7 +2658,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->min = 0;
|
||||
def->readonly = true;
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{ 1500., 1250. });
|
||||
|
||||
def = this->add("fan_max_speed", coInts);
|
||||
def->label = L("Fan speed");
|
||||
|
@ -2666,7 +2678,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm");
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 0. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0. });
|
||||
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
//def = this->add("max_volumetric_extrusion_rate_slope_positive", coFloat);
|
||||
|
@ -2718,7 +2731,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm");
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 0.07 });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0.07 });
|
||||
|
||||
def = this->add("slow_down_min_speed", coFloats);
|
||||
def->label = L("Min print speed");
|
||||
|
@ -2734,7 +2748,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm");
|
||||
def->mode = comAdvanced;
|
||||
def->max = 1.0;
|
||||
def->set_default_value(new ConfigOptionFloats { 0.4 });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0.4 });
|
||||
|
||||
def = this->add("host_type", coEnum);
|
||||
def->label = L("Host Type");
|
||||
|
@ -2961,20 +2976,23 @@ void PrintConfigDef::init_fff_params()
|
|||
def->tooltip = L("Only trigger retraction when the travel distance is longer than this threshold");
|
||||
def->sidetext = L("mm");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 2. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 2. });
|
||||
|
||||
def = this->add("retract_before_wipe", coPercents);
|
||||
def->label = L("Retract amount before wipe");
|
||||
def->tooltip = L("The length of fast retraction before wipe, relative to retraction length");
|
||||
def->sidetext = "%";
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionPercents { 100 });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionPercentsNullable { 100 });
|
||||
|
||||
def = this->add("retract_when_changing_layer", coBools);
|
||||
def->label = L("Retract when change layer");
|
||||
def->tooltip = L("Force a retraction when changes layer");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBools { false });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionBoolsNullable { false });
|
||||
|
||||
def = this->add("retraction_length", coFloats);
|
||||
def->label = L("Length");
|
||||
|
@ -2983,7 +3001,8 @@ void PrintConfigDef::init_fff_params()
|
|||
"Set zero to disable retraction");
|
||||
def->sidetext = L("mm");
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloats { 0.8 });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0.8 });
|
||||
|
||||
def = this->add("enable_long_retraction_when_cut",coInt);
|
||||
def->mode = comDevelop;
|
||||
|
@ -2994,7 +3013,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->tooltip = L("Experimental feature.Retracting and cutting off the filament at a longer distance during changes to minimize purge."
|
||||
"While this reduces flush significantly, it may also raise the risk of nozzle clogs or other printing problems.");
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionBools {false});
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionBoolsNullable {false});
|
||||
|
||||
def = this->add("retraction_distances_when_cut",coFloats);
|
||||
def->label = L("Retraction distance when cut");
|
||||
|
@ -3002,7 +3022,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comDevelop;
|
||||
def->min = 10;
|
||||
def->max = 18;
|
||||
def->set_default_value(new ConfigOptionFloats {18});
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable {18});
|
||||
|
||||
def = this->add("retract_length_toolchange", coFloats);
|
||||
def->label = L("Length");
|
||||
|
@ -3013,7 +3034,8 @@ void PrintConfigDef::init_fff_params()
|
|||
// "the extruder).");
|
||||
def->sidetext = L("mm");
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloats { 10. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 10. });
|
||||
|
||||
def = this->add("z_hop", coFloats);
|
||||
def->label = L("Z hop when retract");
|
||||
|
@ -3024,7 +3046,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comSimple;
|
||||
def->min = 0;
|
||||
def->max = 5;
|
||||
def->set_default_value(new ConfigOptionFloats { 0.4 });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0.4 });
|
||||
|
||||
def = this->add("retract_lift_above", coFloats);
|
||||
def->label = L("Z hop lower boundary");
|
||||
|
@ -3032,7 +3055,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm");
|
||||
def->mode = comAdvanced;
|
||||
def->min = 0;
|
||||
def->set_default_value(new ConfigOptionFloats{0.});
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{0.});
|
||||
|
||||
def = this->add("retract_lift_below", coFloats);
|
||||
def->label = L("Z hop upper boundary");
|
||||
|
@ -3040,7 +3064,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm");
|
||||
def->mode = comAdvanced;
|
||||
def->min = 0;
|
||||
def->set_default_value(new ConfigOptionFloats{0.});
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{0.});
|
||||
|
||||
|
||||
def = this->add("z_hop_types", coEnums);
|
||||
|
@ -3056,7 +3081,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->enum_labels.push_back(L("Slope"));
|
||||
def->enum_labels.push_back(L("Spiral"));
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionEnumsGeneric{ ZHopType::zhtSpiral });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionEnumsGenericNullable{ ZHopType::zhtSpiral });
|
||||
|
||||
def = this->add("extruder_type", coEnums);
|
||||
def->label = L("Type");
|
||||
|
@ -3161,7 +3187,7 @@ void PrintConfigDef::init_fff_params()
|
|||
// "this additional amount of filament. This setting is rarely needed.");
|
||||
def->sidetext = L("mm");
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloats { 0. });
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0. });
|
||||
|
||||
def = this->add("retract_restart_extra_toolchange", coFloats);
|
||||
def->label = L("Extra length on restart");
|
||||
|
@ -3170,7 +3196,8 @@ void PrintConfigDef::init_fff_params()
|
|||
// "this additional amount of filament.");
|
||||
def->sidetext = L("mm");
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloats { 0. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0. });
|
||||
|
||||
def = this->add("retraction_speed", coFloats);
|
||||
def->label = L("Retraction Speed");
|
||||
|
@ -3178,7 +3205,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->tooltip = L("Speed of retractions");
|
||||
def->sidetext = L("mm/s");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 30. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 30. });
|
||||
|
||||
def = this->add("deretraction_speed", coFloats);
|
||||
def->label = L("Deretraction Speed");
|
||||
|
@ -3186,7 +3214,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->tooltip = L("Speed for reloading filament into extruder. Zero means the same speed as retraction");
|
||||
def->sidetext = L("mm/s");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 0. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 0. });
|
||||
|
||||
def = this->add("seam_position", coEnum);
|
||||
def->label = L("Seam position");
|
||||
|
@ -3872,7 +3901,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->full_label = L("Nozzle temperature");
|
||||
def->min = 0;
|
||||
def->max = max_temp;
|
||||
def->set_default_value(new ConfigOptionInts { 200 });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionIntsNullable { 200 });
|
||||
|
||||
def = this->add("nozzle_temperature_range_low", coInts);
|
||||
def->label = L("Min");
|
||||
|
@ -3990,7 +4020,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->tooltip = L("Move nozzle along the last extrusion path when retracting to clean leaked material on nozzle. "
|
||||
"This can minimize blob when printing new part after travel");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBools { false });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionBoolsNullable { false });
|
||||
|
||||
def = this->add("wipe_distance", coFloats);
|
||||
def->label = L("Wipe Distance");
|
||||
|
@ -3998,7 +4029,8 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm");
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 2. });
|
||||
def->nullable = true;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable { 2. });
|
||||
|
||||
def = this->add("enable_prime_tower", coBool);
|
||||
def->label = L("Enable");
|
||||
|
@ -4254,10 +4286,10 @@ void PrintConfigDef::init_fff_params()
|
|||
else
|
||||
def->mode = comAdvanced;
|
||||
switch (def->type) {
|
||||
case coFloats : def->set_default_value(new ConfigOptionFloatsNullable (static_cast<const ConfigOptionFloats* >(it_opt->second.default_value.get())->values)); break;
|
||||
case coPercents : def->set_default_value(new ConfigOptionPercentsNullable(static_cast<const ConfigOptionPercents*>(it_opt->second.default_value.get())->values)); break;
|
||||
case coBools : def->set_default_value(new ConfigOptionBoolsNullable (static_cast<const ConfigOptionBools* >(it_opt->second.default_value.get())->values)); break;
|
||||
case coEnums : def->set_default_value(new ConfigOptionEnumsGenericNullable(static_cast<const ConfigOptionEnumsGeneric* >(it_opt->second.default_value.get())->values)); break;
|
||||
case coFloats: def->set_default_value(new ConfigOptionFloatsNullable(static_cast<const ConfigOptionFloatsNullable*>(it_opt->second.default_value.get())->values)); break;
|
||||
case coPercents: def->set_default_value(new ConfigOptionPercentsNullable(static_cast<const ConfigOptionPercentsNullable*>(it_opt->second.default_value.get())->values)); break;
|
||||
case coBools: def->set_default_value(new ConfigOptionBoolsNullable(static_cast<const ConfigOptionBools*>(it_opt->second.default_value.get())->values)); break;
|
||||
case coEnums: def->set_default_value(new ConfigOptionEnumsGenericNullable(static_cast<const ConfigOptionEnumsGenericNullable*>(it_opt->second.default_value.get())->values)); break;
|
||||
default: assert(false);
|
||||
}
|
||||
}
|
||||
|
@ -5270,7 +5302,7 @@ void DynamicPrintConfig::normalize_fdm(int used_filaments)
|
|||
if (this->has("spiral_mode") && this->opt<ConfigOptionBool>("spiral_mode", true)->value) {
|
||||
{
|
||||
// this should be actually done only on the spiral layers instead of all
|
||||
auto* opt = this->opt<ConfigOptionBools>("retract_when_changing_layer", true);
|
||||
auto* opt = this->opt<ConfigOptionBoolsNullable>("retract_when_changing_layer", true);
|
||||
opt->values.assign(opt->values.size(), false); // set all values to false
|
||||
// Disable retract on layer change also for filament overrides.
|
||||
auto* opt_n = this->opt<ConfigOptionBoolsNullable>("filament_retract_when_changing_layer", true);
|
||||
|
@ -5342,7 +5374,7 @@ void DynamicPrintConfig::normalize_fdm_1()
|
|||
if (this->has("spiral_mode") && this->opt<ConfigOptionBool>("spiral_mode", true)->value) {
|
||||
{
|
||||
// this should be actually done only on the spiral layers instead of all
|
||||
auto* opt = this->opt<ConfigOptionBools>("retract_when_changing_layer", true);
|
||||
auto* opt = this->opt<ConfigOptionBoolsNullable>("retract_when_changing_layer", true);
|
||||
opt->values.assign(opt->values.size(), false); // set all values to false
|
||||
// Disable retract on layer change also for filament overrides.
|
||||
auto* opt_n = this->opt<ConfigOptionBoolsNullable>("filament_retract_when_changing_layer", true);
|
||||
|
@ -5592,7 +5624,7 @@ bool DynamicPrintConfig::is_using_different_extruders()
|
|||
{
|
||||
bool ret = false;
|
||||
|
||||
auto nozzle_diameters_opt = dynamic_cast<const ConfigOptionFloats*>(this->option("nozzle_diameter"));
|
||||
auto nozzle_diameters_opt = dynamic_cast<const ConfigOptionFloatsNullable*>(this->option("nozzle_diameter"));
|
||||
if (nozzle_diameters_opt != nullptr) {
|
||||
int size = nozzle_diameters_opt->size();
|
||||
if (size > 1) {
|
||||
|
@ -5621,7 +5653,7 @@ bool DynamicPrintConfig::support_different_extruders(int& extruder_count)
|
|||
{
|
||||
std::set<std::string> variant_set;
|
||||
|
||||
auto nozzle_diameters_opt = dynamic_cast<const ConfigOptionFloats*>(this->option("nozzle_diameter"));
|
||||
auto nozzle_diameters_opt = dynamic_cast<const ConfigOptionFloatsNullable*>(this->option("nozzle_diameter"));
|
||||
if (nozzle_diameters_opt != nullptr) {
|
||||
int size = nozzle_diameters_opt->size();
|
||||
extruder_count = size;
|
||||
|
|
|
@ -925,30 +925,30 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
MachineEnvelopeConfig,
|
||||
|
||||
// M201 X... Y... Z... E... [mm/sec^2]
|
||||
((ConfigOptionFloats, machine_max_acceleration_x))
|
||||
((ConfigOptionFloats, machine_max_acceleration_y))
|
||||
((ConfigOptionFloats, machine_max_acceleration_z))
|
||||
((ConfigOptionFloats, machine_max_acceleration_e))
|
||||
((ConfigOptionFloatsNullable, machine_max_acceleration_x))
|
||||
((ConfigOptionFloatsNullable, machine_max_acceleration_y))
|
||||
((ConfigOptionFloatsNullable, machine_max_acceleration_z))
|
||||
((ConfigOptionFloatsNullable, machine_max_acceleration_e))
|
||||
// M203 X... Y... Z... E... [mm/sec]
|
||||
((ConfigOptionFloats, machine_max_speed_x))
|
||||
((ConfigOptionFloats, machine_max_speed_y))
|
||||
((ConfigOptionFloats, machine_max_speed_z))
|
||||
((ConfigOptionFloats, machine_max_speed_e))
|
||||
((ConfigOptionFloatsNullable, machine_max_speed_x))
|
||||
((ConfigOptionFloatsNullable, machine_max_speed_y))
|
||||
((ConfigOptionFloatsNullable, machine_max_speed_z))
|
||||
((ConfigOptionFloatsNullable, machine_max_speed_e))
|
||||
|
||||
// M204 P... R... T...[mm/sec^2]
|
||||
((ConfigOptionFloats, machine_max_acceleration_extruding))
|
||||
((ConfigOptionFloats, machine_max_acceleration_retracting))
|
||||
((ConfigOptionFloats, machine_max_acceleration_travel))
|
||||
((ConfigOptionFloatsNullable, machine_max_acceleration_extruding))
|
||||
((ConfigOptionFloatsNullable, machine_max_acceleration_retracting))
|
||||
((ConfigOptionFloatsNullable, machine_max_acceleration_travel))
|
||||
|
||||
// M205 X... Y... Z... E... [mm/sec]
|
||||
((ConfigOptionFloats, machine_max_jerk_x))
|
||||
((ConfigOptionFloats, machine_max_jerk_y))
|
||||
((ConfigOptionFloats, machine_max_jerk_z))
|
||||
((ConfigOptionFloats, machine_max_jerk_e))
|
||||
((ConfigOptionFloatsNullable, machine_max_jerk_x))
|
||||
((ConfigOptionFloatsNullable, machine_max_jerk_y))
|
||||
((ConfigOptionFloatsNullable, machine_max_jerk_z))
|
||||
((ConfigOptionFloatsNullable, machine_max_jerk_e))
|
||||
// M205 T... [mm/sec]
|
||||
((ConfigOptionFloats, machine_min_travel_rate))
|
||||
((ConfigOptionFloatsNullable, machine_min_travel_rate))
|
||||
// M205 S... [mm/sec]
|
||||
((ConfigOptionFloats, machine_min_extruding_rate))
|
||||
((ConfigOptionFloatsNullable, machine_min_extruding_rate))
|
||||
)
|
||||
|
||||
// This object is mapped to Perl as Slic3r::Config::GCode.
|
||||
|
@ -957,7 +957,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
|
||||
((ConfigOptionString, before_layer_change_gcode))
|
||||
((ConfigOptionString, printing_by_object_gcode))
|
||||
((ConfigOptionFloats, deretraction_speed))
|
||||
((ConfigOptionFloatsNullable, deretraction_speed))
|
||||
//BBS
|
||||
((ConfigOptionBool, enable_arc_fitting))
|
||||
((ConfigOptionString, machine_end_gcode))
|
||||
|
@ -978,7 +978,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionString, filament_notes))
|
||||
((ConfigOptionStrings, default_filament_colour))
|
||||
((ConfigOptionInts, temperature_vitrification)) //BBS
|
||||
((ConfigOptionFloats, filament_max_volumetric_speed))
|
||||
((ConfigOptionFloatsNullable, filament_max_volumetric_speed))
|
||||
((ConfigOptionInts, required_nozzle_HRC))
|
||||
((ConfigOptionEnum<FilamentMapMode>, filament_map_mode))
|
||||
((ConfigOptionInts, filament_map))
|
||||
|
@ -1001,20 +1001,20 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
// ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive))
|
||||
// ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_negative))
|
||||
//#endif
|
||||
((ConfigOptionPercents, retract_before_wipe))
|
||||
((ConfigOptionFloats, retraction_length))
|
||||
((ConfigOptionFloats, retract_length_toolchange))
|
||||
((ConfigOptionPercentsNullable, retract_before_wipe))
|
||||
((ConfigOptionFloatsNullable, retraction_length))
|
||||
((ConfigOptionFloatsNullable, retract_length_toolchange))
|
||||
((ConfigOptionInt, enable_long_retraction_when_cut))
|
||||
((ConfigOptionFloats, retraction_distances_when_cut))
|
||||
((ConfigOptionBools, long_retractions_when_cut))
|
||||
((ConfigOptionFloats, z_hop))
|
||||
((ConfigOptionFloatsNullable, retraction_distances_when_cut))
|
||||
((ConfigOptionBoolsNullable, long_retractions_when_cut))
|
||||
((ConfigOptionFloatsNullable, z_hop))
|
||||
// BBS
|
||||
((ConfigOptionEnumsGeneric, z_hop_types))
|
||||
((ConfigOptionFloats, retract_restart_extra))
|
||||
((ConfigOptionFloats, retract_restart_extra_toolchange))
|
||||
((ConfigOptionFloats, retraction_speed))
|
||||
((ConfigOptionFloats, retract_lift_above))
|
||||
((ConfigOptionFloats, retract_lift_below))
|
||||
((ConfigOptionEnumsGenericNullable,z_hop_types))
|
||||
((ConfigOptionFloatsNullable, retract_restart_extra))
|
||||
((ConfigOptionFloatsNullable, retract_restart_extra_toolchange))
|
||||
((ConfigOptionFloatsNullable, retraction_speed))
|
||||
((ConfigOptionFloatsNullable, retract_lift_above))
|
||||
((ConfigOptionFloatsNullable, retract_lift_below))
|
||||
((ConfigOptionString, machine_start_gcode))
|
||||
((ConfigOptionStrings, filament_start_gcode))
|
||||
((ConfigOptionBool, single_extruder_multi_material))
|
||||
|
@ -1082,8 +1082,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionInt, other_layers_print_sequence_nums))
|
||||
((ConfigOptionBools, slow_down_for_layer_cooling))
|
||||
((ConfigOptionFloatsNullable, default_acceleration))
|
||||
((ConfigOptionFloats, inner_wall_acceleration))
|
||||
((ConfigOptionFloatsOrPercents, sparse_infill_acceleration))
|
||||
((ConfigOptionFloatsNullable, inner_wall_acceleration))
|
||||
((ConfigOptionFloatsOrPercentsNullable, sparse_infill_acceleration))
|
||||
((ConfigOptionBools, activate_air_filtration))
|
||||
((ConfigOptionInts, during_print_exhaust_fan_speed))
|
||||
((ConfigOptionInts, complete_print_exhaust_fan_speed))
|
||||
|
@ -1099,7 +1099,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionBools, reduce_fan_stop_start_freq))
|
||||
((ConfigOptionInts, fan_cooling_layer_time))
|
||||
((ConfigOptionStrings, filament_colour))
|
||||
((ConfigOptionFloats, top_surface_acceleration))
|
||||
((ConfigOptionFloatsNullable, top_surface_acceleration))
|
||||
((ConfigOptionFloatsNullable, outer_wall_acceleration))
|
||||
((ConfigOptionFloatsNullable, initial_layer_acceleration))
|
||||
((ConfigOptionFloat, initial_layer_line_width))
|
||||
|
@ -1107,17 +1107,17 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionFloatsNullable, initial_layer_speed))
|
||||
//BBS
|
||||
((ConfigOptionFloatsNullable, initial_layer_infill_speed))
|
||||
((ConfigOptionInts, nozzle_temperature_initial_layer))
|
||||
((ConfigOptionIntsNullable, nozzle_temperature_initial_layer))
|
||||
((ConfigOptionInts, full_fan_speed_layer))
|
||||
((ConfigOptionInts, fan_max_speed))
|
||||
((ConfigOptionFloats, max_layer_height))
|
||||
((ConfigOptionFloatsNullable, max_layer_height))
|
||||
((ConfigOptionInts, fan_min_speed))
|
||||
((ConfigOptionFloats, min_layer_height))
|
||||
((ConfigOptionFloatsNullable, min_layer_height))
|
||||
((ConfigOptionString, printer_notes))
|
||||
((ConfigOptionFloat, printable_height))
|
||||
((ConfigOptionPoint, best_object_pos))
|
||||
((ConfigOptionFloats, slow_down_min_speed))
|
||||
((ConfigOptionFloats, nozzle_diameter))
|
||||
((ConfigOptionFloatsNullable, nozzle_diameter))
|
||||
((ConfigOptionBool, reduce_infill_retraction))
|
||||
((ConfigOptionBool, ooze_prevention))
|
||||
((ConfigOptionString, filename_format))
|
||||
|
@ -1125,8 +1125,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionString, printer_model))
|
||||
((ConfigOptionString, process_notes))
|
||||
((ConfigOptionFloat, resolution))
|
||||
((ConfigOptionFloats, retraction_minimum_travel))
|
||||
((ConfigOptionBools, retract_when_changing_layer))
|
||||
((ConfigOptionFloatsNullable, retraction_minimum_travel))
|
||||
((ConfigOptionBoolsNullable, retract_when_changing_layer))
|
||||
((ConfigOptionFloat, skirt_distance))
|
||||
((ConfigOptionInt, skirt_height))
|
||||
((ConfigOptionInt, skirt_loops))
|
||||
|
@ -1135,13 +1135,13 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionBool, spiral_mode_smooth))
|
||||
((ConfigOptionFloatOrPercent, spiral_mode_max_xy_smoothing))
|
||||
((ConfigOptionInt, standby_temperature_delta))
|
||||
((ConfigOptionInts, nozzle_temperature))
|
||||
((ConfigOptionIntsNullable, nozzle_temperature))
|
||||
((ConfigOptionInts, chamber_temperatures))
|
||||
((ConfigOptionBools, wipe))
|
||||
((ConfigOptionBoolsNullable, wipe))
|
||||
// BBS
|
||||
((ConfigOptionInts, nozzle_temperature_range_low))
|
||||
((ConfigOptionInts, nozzle_temperature_range_high))
|
||||
((ConfigOptionFloats, wipe_distance))
|
||||
((ConfigOptionFloatsNullable, wipe_distance))
|
||||
((ConfigOptionBool, enable_prime_tower))
|
||||
// BBS: change wipe_tower_x and wipe_tower_y data type to floats to add partplate logic
|
||||
((ConfigOptionFloats, wipe_tower_x))
|
||||
|
|
|
@ -45,7 +45,7 @@ inline coordf_t max_layer_height_from_nozzle(const PrintConfig &print_config, in
|
|||
// Minimum layer height for the variable layer height algorithm.
|
||||
coordf_t Slicing::min_layer_height_from_nozzle(const DynamicPrintConfig &print_config, int idx_nozzle)
|
||||
{
|
||||
coordf_t min_layer_height = print_config.opt_float("min_layer_height", idx_nozzle - 1);
|
||||
coordf_t min_layer_height = print_config.opt_float_nullable("min_layer_height", idx_nozzle - 1);
|
||||
return (min_layer_height == 0.) ? MIN_LAYER_HEIGHT_DEFAULT : std::max(MIN_LAYER_HEIGHT, min_layer_height);
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,8 @@ coordf_t Slicing::min_layer_height_from_nozzle(const DynamicPrintConfig &print_c
|
|||
coordf_t Slicing::max_layer_height_from_nozzle(const DynamicPrintConfig &print_config, int idx_nozzle)
|
||||
{
|
||||
coordf_t min_layer_height = min_layer_height_from_nozzle(print_config, idx_nozzle);
|
||||
coordf_t max_layer_height = print_config.opt_float("max_layer_height", idx_nozzle - 1);
|
||||
coordf_t nozzle_dmr = print_config.opt_float("nozzle_diameter", idx_nozzle - 1);
|
||||
coordf_t max_layer_height = print_config.opt_float_nullable("max_layer_height", idx_nozzle - 1);
|
||||
coordf_t nozzle_dmr = print_config.opt_float_nullable("nozzle_diameter", idx_nozzle - 1);
|
||||
return std::max(min_layer_height, (max_layer_height == 0.) ? (0.75 * nozzle_dmr) : max_layer_height);
|
||||
}
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ void AmsMapingPopup::update(MachineObject* obj)
|
|||
|
||||
/*ext*/
|
||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
if (nozzle_nums == 1) {
|
||||
m_warning_text->SetMinSize(wxSize(FromDIP(248), FromDIP(-1)));
|
||||
m_warning_text->Wrap(FromDIP(248));
|
||||
|
|
|
@ -513,9 +513,9 @@ void PressureAdvanceWizard::on_device_connected(MachineObject* obj)
|
|||
|
||||
static bool get_preset_info(const DynamicConfig& config, const BedType plate_type, int& nozzle_temp, int& bed_temp, float& max_volumetric_speed)
|
||||
{
|
||||
const ConfigOptionInts* nozzle_temp_opt = config.option<ConfigOptionInts>("nozzle_temperature");
|
||||
const ConfigOptionIntsNullable* nozzle_temp_opt = config.option<ConfigOptionIntsNullable>("nozzle_temperature");
|
||||
const ConfigOptionInts* opt_bed_temp_ints = config.option<ConfigOptionInts>(get_bed_temp_key(plate_type));
|
||||
const ConfigOptionFloats* speed_opt = config.option<ConfigOptionFloats>("filament_max_volumetric_speed");
|
||||
const ConfigOptionFloatsNullable* speed_opt = config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed");
|
||||
if (nozzle_temp_opt && speed_opt && opt_bed_temp_ints) {
|
||||
nozzle_temp = nozzle_temp_opt->get_at(0);
|
||||
max_volumetric_speed = speed_opt->get_at(0);
|
||||
|
@ -1463,7 +1463,7 @@ void MaxVolumetricSpeedWizard::on_cali_save()
|
|||
return;
|
||||
|
||||
std::map<std::string, ConfigOption *> key_value_map;
|
||||
key_value_map.insert(std::make_pair("filament_max_volumetric_speed", new ConfigOptionFloats{ value }));
|
||||
key_value_map.insert(std::make_pair("filament_max_volumetric_speed", new ConfigOptionFloatsNullable{ value }));
|
||||
|
||||
wxString message;
|
||||
if (!save_preset(old_preset_name, new_preset_name, key_value_map, message)) {
|
||||
|
|
|
@ -954,7 +954,7 @@ void CalibrationPresetPage::on_recommend_input_value()
|
|||
Preset* selected_filament_preset = selected_filaments.begin()->second;
|
||||
if (selected_filament_preset) {
|
||||
if (m_custom_range_panel) {
|
||||
const ConfigOptionFloats* speed_opt = selected_filament_preset->config.option<ConfigOptionFloats>("filament_max_volumetric_speed");
|
||||
const ConfigOptionFloatsNullable* speed_opt = selected_filament_preset->config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed");
|
||||
if (speed_opt) {
|
||||
double max_volumetric_speed = speed_opt->get_at(0);
|
||||
wxArrayString values;
|
||||
|
|
|
@ -85,7 +85,7 @@ void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *conf
|
|||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||
|
||||
if (config->has("nozzle_temperature")) {
|
||||
if (config->opt_int("nozzle_temperature", 0) < temperature_range_low || config->opt_int("nozzle_temperature", 0) > temperature_range_high) {
|
||||
if (config->opt_int_nullable("nozzle_temperature", 0) < temperature_range_low || config->opt_int_nullable("nozzle_temperature", 0) > temperature_range_high) {
|
||||
wxString msg_text = _(L("Nozzle may be blocked when the temperature is out of recommended range.\n"
|
||||
"Please confirm whether to use the temperature for printing.\n\n"));
|
||||
msg_text += wxString::Format(_L("Recommended nozzle temperature of this filament type is [%d, %d] degree centigrade"), temperature_range_low, temperature_range_high);
|
||||
|
@ -106,8 +106,8 @@ void ConfigManipulation::check_nozzle_temperature_initial_layer_range(DynamicPri
|
|||
if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return;
|
||||
|
||||
if (config->has("nozzle_temperature_initial_layer")) {
|
||||
if (config->opt_int("nozzle_temperature_initial_layer", 0) < temperature_range_low ||
|
||||
config->opt_int("nozzle_temperature_initial_layer", 0) > temperature_range_high)
|
||||
if (config->opt_int_nullable("nozzle_temperature_initial_layer", 0) < temperature_range_low ||
|
||||
config->opt_int_nullable("nozzle_temperature_initial_layer", 0) > temperature_range_high)
|
||||
{
|
||||
wxString msg_text = _(L("Nozzle may be blocked when the temperature is out of recommended range.\n"
|
||||
"Please confirm whether to use the temperature for printing.\n\n"));
|
||||
|
@ -126,7 +126,7 @@ void ConfigManipulation::check_filament_max_volumetric_speed(DynamicPrintConfig
|
|||
//if (is_msg_dlg_already_exist) return;
|
||||
//float max_volumetric_speed = config->opt_float("filament_max_volumetric_speed");
|
||||
|
||||
float max_volumetric_speed = config->has("filament_max_volumetric_speed") ? config->opt_float("filament_max_volumetric_speed", (float) 0.5) : 0.5;
|
||||
float max_volumetric_speed = config->has("filament_max_volumetric_speed") ? config->opt_float_nullable("filament_max_volumetric_speed", (float) 0.5) : 0.5;
|
||||
// BBS: limite the min max_volumetric_speed
|
||||
if (max_volumetric_speed < 0.5) {
|
||||
const wxString msg_text = _(L("Too small max volumetric speed.\nReset to 0.5"));
|
||||
|
@ -134,7 +134,7 @@ void ConfigManipulation::check_filament_max_volumetric_speed(DynamicPrintConfig
|
|||
DynamicPrintConfig new_conf = *config;
|
||||
is_msg_dlg_already_exist = true;
|
||||
dialog.ShowModal();
|
||||
new_conf.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats({0.5}));
|
||||
new_conf.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloatsNullable({0.5}));
|
||||
apply(config, &new_conf);
|
||||
is_msg_dlg_already_exist = false;
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in
|
|||
toggle_field(el, has_top_solid_infill || (has_spiral_vase && has_bottom_solid_infill));
|
||||
|
||||
// todo multi_extruders: the exact filament id
|
||||
bool have_default_acceleration = config->opt_float("default_acceleration", 0) > 0;
|
||||
bool have_default_acceleration = config->opt_float_nullable("default_acceleration", 0) > 0;
|
||||
//BBS
|
||||
for (auto el : { "initial_layer_acceleration", "outer_wall_acceleration", "top_surface_acceleration", "inner_wall_acceleration", "sparse_infill_acceleration" })
|
||||
toggle_field(el, have_default_acceleration);
|
||||
|
@ -676,7 +676,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in
|
|||
toggle_line("max_travel_detour_distance", have_avoid_crossing_perimeters);
|
||||
|
||||
// todo multi_extruders:
|
||||
bool has_overhang_speed = config->opt_bool("enable_overhang_speed", variant_index);
|
||||
bool has_overhang_speed = config->opt_bool_nullable("enable_overhang_speed", variant_index);
|
||||
for (auto el : { "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed"})
|
||||
toggle_line(el, has_overhang_speed, variant_index);
|
||||
|
||||
|
|
|
@ -1338,7 +1338,7 @@ PageDiameters::PageDiameters(ConfigWizard *parent)
|
|||
, diam_nozzle(new DiamTextCtrl(this))
|
||||
, diam_filam (new DiamTextCtrl(this))
|
||||
{
|
||||
auto *default_nozzle = print_config_def.get("nozzle_diameter")->get_default_value<ConfigOptionFloats>();
|
||||
auto *default_nozzle = print_config_def.get("nozzle_diameter")->get_default_value<ConfigOptionFloatsNullable>();
|
||||
wxString value = double_to_string(default_nozzle != nullptr && default_nozzle->size() > 0 ? default_nozzle->get_at(0) : 0.5);
|
||||
diam_nozzle->SetValue(value);
|
||||
|
||||
|
|
|
@ -462,8 +462,8 @@ void ExtrusionCalibration::on_click_cali(wxCommandEvent& event)
|
|||
if (filament_name.compare(m_comboBox_filament->GetValue()) == 0) {
|
||||
try {
|
||||
bed_temp = get_bed_temp(&it->config);
|
||||
const ConfigOptionInts* nozzle_temp_opt = it->config.option<ConfigOptionInts>("nozzle_temperature");
|
||||
const ConfigOptionFloats* speed_opt = it->config.option<ConfigOptionFloats>("filament_max_volumetric_speed");
|
||||
const ConfigOptionIntsNullable* nozzle_temp_opt = it->config.option<ConfigOptionIntsNullable>("nozzle_temperature");
|
||||
const ConfigOptionFloatsNullable* speed_opt = it->config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed");
|
||||
if (nozzle_temp_opt && speed_opt) {
|
||||
nozzle_temp = nozzle_temp_opt->get_at(0);
|
||||
max_volumetric_speed = speed_opt->get_at(0);
|
||||
|
@ -582,8 +582,8 @@ void ExtrusionCalibration::on_click_save(wxCommandEvent &event)
|
|||
if (filament_name.compare(m_comboBox_filament->GetValue()) == 0) {
|
||||
if (obj) {
|
||||
bed_temp = get_bed_temp(&it->config);
|
||||
const ConfigOptionInts* nozzle_temp_opt = it->config.option<ConfigOptionInts>("nozzle_temperature");
|
||||
const ConfigOptionFloats* speed_opt = it->config.option<ConfigOptionFloats>("filament_max_volumetric_speed");
|
||||
const ConfigOptionIntsNullable* nozzle_temp_opt = it->config.option<ConfigOptionIntsNullable>("nozzle_temperature");
|
||||
const ConfigOptionFloatsNullable* speed_opt = it->config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed");
|
||||
if (nozzle_temp_opt && speed_opt) {
|
||||
nozzle_temp = nozzle_temp_opt->get_at(0);
|
||||
max_volumetric_speed = speed_opt->get_at(0);
|
||||
|
@ -799,7 +799,7 @@ void ExtrusionCalibration::update_filament_info()
|
|||
// update nozzle temperature
|
||||
ConfigOption* opt_nozzle_temp = filament_it->config.option("nozzle_temperature");
|
||||
if (opt_nozzle_temp) {
|
||||
ConfigOptionInts* opt_min_ints = dynamic_cast<ConfigOptionInts*>(opt_nozzle_temp);
|
||||
ConfigOptionIntsNullable* opt_min_ints = dynamic_cast<ConfigOptionIntsNullable*>(opt_nozzle_temp);
|
||||
if (opt_min_ints) {
|
||||
wxString text_nozzle_temp = wxString::Format("%d", opt_min_ints->get_at(0));
|
||||
m_nozzle_temp->GetTextCtrl()->SetValue(text_nozzle_temp);
|
||||
|
@ -813,7 +813,7 @@ void ExtrusionCalibration::update_filament_info()
|
|||
// update max flow speed
|
||||
ConfigOption* opt_flow_speed = filament_it->config.option("filament_max_volumetric_speed");
|
||||
if (opt_flow_speed) {
|
||||
ConfigOptionFloats* opt_flow_floats = dynamic_cast<ConfigOptionFloats*>(opt_flow_speed);
|
||||
ConfigOptionFloatsNullable* opt_flow_floats = dynamic_cast<ConfigOptionFloatsNullable*>(opt_flow_speed);
|
||||
if (opt_flow_floats) {
|
||||
wxString flow_val_text = wxString::Format("%0.2f", opt_flow_floats->get_at(0));
|
||||
m_max_flow_ratio->GetTextCtrl()->SetValue(flow_val_text);
|
||||
|
|
|
@ -1024,7 +1024,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
|
|||
load_toolpaths(gcode_result, build_volume, exclude_bounding_box);
|
||||
|
||||
// BBS: data for rendering color arrangement recommendation
|
||||
m_nozzle_nums = print.config().option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
m_nozzle_nums = print.config().option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
std::vector<int> filament_maps = print.get_filament_maps();
|
||||
std::vector<std::string> color_opt = print.config().option<ConfigOptionStrings>("filament_colour")->values;
|
||||
std::vector<std::string> type_opt = print.config().option<ConfigOptionStrings>("filament_type")->values;
|
||||
|
|
|
@ -6759,7 +6759,7 @@ int GUI_App::extruders_cnt() const
|
|||
{
|
||||
const Preset& preset = preset_bundle->printers.get_selected_preset();
|
||||
return preset.printer_technology() == ptSLA ? 1 :
|
||||
preset.config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
preset.config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
}
|
||||
|
||||
// extruders count from edited printer preset
|
||||
|
@ -6767,7 +6767,7 @@ int GUI_App::extruders_edited_cnt() const
|
|||
{
|
||||
const Preset& preset = preset_bundle->printers.get_edited_preset();
|
||||
return preset.printer_technology() == ptSLA ? 1 :
|
||||
preset.config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
preset.config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
}
|
||||
|
||||
// BBS
|
||||
|
|
|
@ -4338,18 +4338,18 @@ void ObjectList::del_layer_range(const t_layer_height_range& range)
|
|||
static double get_min_layer_height(const int extruder_idx)
|
||||
{
|
||||
const DynamicPrintConfig& config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
return config.opt_float("min_layer_height", std::max(0, extruder_idx - 1));
|
||||
return config.opt_float_nullable("min_layer_height", std::max(0, extruder_idx - 1));
|
||||
}
|
||||
|
||||
static double get_max_layer_height(const int extruder_idx)
|
||||
{
|
||||
const DynamicPrintConfig& config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
int extruder_idx_zero_based = std::max(0, extruder_idx - 1);
|
||||
double max_layer_height = config.opt_float("max_layer_height", extruder_idx_zero_based);
|
||||
double max_layer_height = config.opt_float_nullable("max_layer_height", extruder_idx_zero_based);
|
||||
|
||||
// In case max_layer_height is set to zero, it should default to 75 % of nozzle diameter:
|
||||
if (max_layer_height < EPSILON)
|
||||
max_layer_height = 0.75 * config.opt_float("nozzle_diameter", extruder_idx_zero_based);
|
||||
max_layer_height = 0.75 * config.opt_float_nullable("nozzle_diameter", extruder_idx_zero_based);
|
||||
|
||||
return max_layer_height;
|
||||
}
|
||||
|
|
|
@ -707,7 +707,7 @@ void ConfigOptionsGroup::back_to_config_value(const DynamicPrintConfig& config,
|
|||
{
|
||||
boost::any value;
|
||||
if (opt_key == "extruders_count") {
|
||||
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(config.option("nozzle_diameter"));
|
||||
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloatsNullable*>(config.option("nozzle_diameter"));
|
||||
value = int(nozzle_diameter->values.size());
|
||||
}
|
||||
#if 0
|
||||
|
@ -988,11 +988,11 @@ boost::any ConfigOptionsGroup::config_value(const std::string& opt_key, int opt_
|
|||
|
||||
boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config, const std::string& opt_key, int opt_index /*= -1*/)
|
||||
{
|
||||
size_t idx = opt_index == -1 ? 0 : opt_index;
|
||||
size_t idx = opt_index == -1 ? 0 : opt_index;
|
||||
|
||||
boost::any ret;
|
||||
wxString text_value = wxString("");
|
||||
const ConfigOptionDef* opt = config.def()->get(opt_key);
|
||||
boost::any ret;
|
||||
wxString text_value = wxString("");
|
||||
const ConfigOptionDef* opt = config.def()->get(opt_key);
|
||||
|
||||
if (opt->nullable)
|
||||
{
|
||||
|
@ -1004,11 +1004,12 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||
ret = _(L("N/A"));
|
||||
else {
|
||||
double val = opt->type == coFloats ?
|
||||
config.option<ConfigOptionFloatsNullable>(opt_key)->get_at(idx) :
|
||||
config.option<ConfigOptionPercentsNullable>(opt_key)->get_at(idx);
|
||||
ret = double_to_string(val); }
|
||||
config.option<ConfigOptionFloatsNullable>(opt_key)->get_at(idx) :
|
||||
config.option<ConfigOptionPercentsNullable>(opt_key)->get_at(idx);
|
||||
ret = double_to_string(val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case coFloatsOrPercents: {
|
||||
if (opt_index < 0 ? config.option(opt_key)->is_nil() : dynamic_cast<ConfigOptionVectorBase const*>(config.option(opt_key))->is_nil(opt_index))
|
||||
ret = _(L("N/A"));
|
||||
|
@ -1037,17 +1038,17 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||
return ret;
|
||||
}
|
||||
|
||||
switch (opt->type) {
|
||||
case coFloatOrPercent:{
|
||||
const auto &value = *config.option<ConfigOptionFloatOrPercent>(opt_key);
|
||||
switch (opt->type) {
|
||||
case coFloatOrPercent: {
|
||||
const auto& value = *config.option<ConfigOptionFloatOrPercent>(opt_key);
|
||||
|
||||
text_value = double_to_string(value.value);
|
||||
if (value.percent)
|
||||
text_value += "%";
|
||||
if (value.percent)
|
||||
text_value += "%";
|
||||
|
||||
ret = text_value;
|
||||
break;
|
||||
}
|
||||
ret = text_value;
|
||||
break;
|
||||
}
|
||||
case coFloatsOrPercents: {
|
||||
const auto &value = config.option<ConfigOptionFloatsOrPercents>(opt_key)->get_at(idx);
|
||||
|
||||
|
@ -1058,54 +1059,54 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||
break;
|
||||
}
|
||||
case coPercent: {
|
||||
double val = config.option<ConfigOptionPercent>(opt_key)->value;
|
||||
text_value = wxString::Format(_T("%i"), int(val));
|
||||
ret = text_value;// += "%";
|
||||
}
|
||||
break;
|
||||
case coPercents:
|
||||
case coFloats:
|
||||
case coFloat:{
|
||||
double val = opt->type == coFloats ?
|
||||
config.opt_float(opt_key, idx) :
|
||||
opt->type == coFloat ? config.opt_float(opt_key) :
|
||||
config.option<ConfigOptionPercents>(opt_key)->get_at(idx);
|
||||
ret = double_to_string(val);
|
||||
}
|
||||
break;
|
||||
case coString:
|
||||
ret = from_u8(config.opt_string(opt_key));
|
||||
break;
|
||||
case coStrings:
|
||||
if (opt_key == "compatible_printers" || opt_key == "compatible_prints") {
|
||||
ret = config.option<ConfigOptionStrings>(opt_key)->values;
|
||||
break;
|
||||
}
|
||||
if (config.option<ConfigOptionStrings>(opt_key)->values.empty())
|
||||
ret = text_value;
|
||||
else if (opt->gui_flags == "serialized") {
|
||||
std::vector<std::string> values = config.option<ConfigOptionStrings>(opt_key)->values;
|
||||
if (!values.empty() && !values[0].empty())
|
||||
for (auto el : values)
|
||||
text_value += el + ";";
|
||||
ret = text_value;
|
||||
}
|
||||
else
|
||||
ret = from_u8(config.opt_string(opt_key, static_cast<unsigned int>(idx)));
|
||||
break;
|
||||
case coBool:
|
||||
ret = config.opt_bool(opt_key);
|
||||
break;
|
||||
case coBools:
|
||||
ret = config.opt_bool(opt_key, idx);
|
||||
break;
|
||||
case coInt:
|
||||
ret = config.opt_int(opt_key);
|
||||
break;
|
||||
case coInts:
|
||||
ret = config.opt_int(opt_key, idx);
|
||||
break;
|
||||
case coEnum:
|
||||
double val = config.option<ConfigOptionPercent>(opt_key)->value;
|
||||
text_value = wxString::Format(_T("%i"), int(val));
|
||||
ret = text_value;// += "%";
|
||||
}
|
||||
break;
|
||||
case coPercents:
|
||||
case coFloats:
|
||||
case coFloat: {
|
||||
double val = opt->type == coFloats ?
|
||||
config.opt_float(opt_key, idx) :
|
||||
opt->type == coFloat ? config.opt_float(opt_key) :
|
||||
config.option<ConfigOptionPercents>(opt_key)->get_at(idx);
|
||||
ret = double_to_string(val);
|
||||
}
|
||||
break;
|
||||
case coString:
|
||||
ret = from_u8(config.opt_string(opt_key));
|
||||
break;
|
||||
case coStrings:
|
||||
if (opt_key == "compatible_printers" || opt_key == "compatible_prints") {
|
||||
ret = config.option<ConfigOptionStrings>(opt_key)->values;
|
||||
break;
|
||||
}
|
||||
if (config.option<ConfigOptionStrings>(opt_key)->values.empty())
|
||||
ret = text_value;
|
||||
else if (opt->gui_flags == "serialized") {
|
||||
std::vector<std::string> values = config.option<ConfigOptionStrings>(opt_key)->values;
|
||||
if (!values.empty() && !values[0].empty())
|
||||
for (auto el : values)
|
||||
text_value += el + ";";
|
||||
ret = text_value;
|
||||
}
|
||||
else
|
||||
ret = from_u8(config.opt_string(opt_key, static_cast<unsigned int>(idx)));
|
||||
break;
|
||||
case coBool:
|
||||
ret = config.opt_bool(opt_key);
|
||||
break;
|
||||
case coBools:
|
||||
ret = config.opt_bool(opt_key, idx);
|
||||
break;
|
||||
case coInt:
|
||||
ret = config.opt_int(opt_key);
|
||||
break;
|
||||
case coInts:
|
||||
ret = config.opt_int(opt_key, idx);
|
||||
break;
|
||||
case coEnum:
|
||||
if (!config.has("first_layer_sequence_choice") && opt_key == "first_layer_sequence_choice") {
|
||||
// reset to Auto value
|
||||
ret = 0;
|
||||
|
@ -1124,28 +1125,28 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||
}
|
||||
ret = config.option(opt_key)->getInt();
|
||||
break;
|
||||
// BBS
|
||||
// BBS
|
||||
case coEnums:
|
||||
ret = config.opt_int(opt_key, idx);
|
||||
break;
|
||||
case coPoint:
|
||||
ret = config.option<ConfigOptionPoint>(opt_key)->value;
|
||||
break;
|
||||
case coPoints:
|
||||
if (opt_key == "printable_area")
|
||||
case coPoints:
|
||||
if (opt_key == "printable_area")
|
||||
ret = get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
|
||||
else if (opt_key == "bed_exclude_area")
|
||||
ret = get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
|
||||
else if (opt_key == "thumbnail_size")
|
||||
ret = get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
|
||||
else
|
||||
ret = config.option<ConfigOptionPoints>(opt_key)->get_at(idx);
|
||||
break;
|
||||
case coNone:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
else
|
||||
ret = config.option<ConfigOptionPoints>(opt_key)->get_at(idx);
|
||||
break;
|
||||
case coNone:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// BBS: restore all pages in preset
|
||||
|
|
|
@ -505,7 +505,7 @@ std::vector<int> get_min_flush_volumes(const DynamicPrintConfig &full_config, si
|
|||
machine_enabled_level = enable_long_retraction_when_cut_opt->value;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": get enable_long_retraction_when_cut from config, value=%1%")%machine_enabled_level;
|
||||
}
|
||||
const ConfigOptionBools* long_retractions_when_cut_opt = full_config.option<ConfigOptionBools>("long_retractions_when_cut");
|
||||
const ConfigOptionBoolsNullable* long_retractions_when_cut_opt = full_config.option<ConfigOptionBoolsNullable>("long_retractions_when_cut");
|
||||
bool machine_activated = false;
|
||||
if (long_retractions_when_cut_opt) {
|
||||
machine_activated = long_retractions_when_cut_opt->values[nozzle_id] == 1;
|
||||
|
@ -515,19 +515,19 @@ std::vector<int> get_min_flush_volumes(const DynamicPrintConfig &full_config, si
|
|||
size_t filament_size = full_config.option<ConfigOptionFloats>("filament_diameter")->values.size();
|
||||
std::vector<double> filament_retraction_distance_when_cut(filament_size, 18.0f), printer_retraction_distance_when_cut(filament_size, 18.0f);
|
||||
std::vector<unsigned char> filament_long_retractions_when_cut(filament_size, 0);
|
||||
const ConfigOptionFloats* filament_retraction_distances_when_cut_opt = full_config.option<ConfigOptionFloats>("filament_retraction_distances_when_cut");
|
||||
const ConfigOptionFloatsNullable* filament_retraction_distances_when_cut_opt = full_config.option<ConfigOptionFloatsNullable>("filament_retraction_distances_when_cut");
|
||||
if (filament_retraction_distances_when_cut_opt) {
|
||||
filament_retraction_distance_when_cut = filament_retraction_distances_when_cut_opt->values;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": get filament_retraction_distance_when_cut from config, size=%1%, values=%2%")%filament_retraction_distance_when_cut.size() %filament_retraction_distances_when_cut_opt->serialize();
|
||||
}
|
||||
|
||||
const ConfigOptionFloats* printer_retraction_distance_when_cut_opt = full_config.option<ConfigOptionFloats>("retraction_distances_when_cut");
|
||||
const ConfigOptionFloatsNullable* printer_retraction_distance_when_cut_opt = full_config.option<ConfigOptionFloatsNullable>("retraction_distances_when_cut");
|
||||
if (printer_retraction_distance_when_cut_opt) {
|
||||
printer_retraction_distance_when_cut = printer_retraction_distance_when_cut_opt->values;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": get retraction_distances_when_cut from config, size=%1%, values=%2%")%printer_retraction_distance_when_cut.size() %printer_retraction_distance_when_cut_opt->serialize();
|
||||
}
|
||||
|
||||
const ConfigOptionBools* filament_long_retractions_when_cut_opt = full_config.option<ConfigOptionBools>("filament_long_retractions_when_cut");
|
||||
const ConfigOptionBoolsNullable* filament_long_retractions_when_cut_opt = full_config.option<ConfigOptionBoolsNullable>("filament_long_retractions_when_cut");
|
||||
if (filament_long_retractions_when_cut_opt) {
|
||||
filament_long_retractions_when_cut = filament_long_retractions_when_cut_opt->values;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": get filament_long_retractions_when_cut from config, size=%1%, values=%2%")%filament_long_retractions_when_cut.size() %filament_long_retractions_when_cut_opt->serialize();
|
||||
|
@ -1066,7 +1066,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
const auto& extra_flush_volumes = get_min_flush_volumes(full_config, 0); // todo multi_extruder: always display nozzle 1
|
||||
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
|
||||
std::vector<float> flush_multiplier;
|
||||
ConfigOptionFloats *flush_multi_opt = project_config.option<ConfigOptionFloats>("flush_multiplier");
|
||||
|
@ -8040,7 +8040,7 @@ PlateBBoxData Plater::priv::generate_first_layer_bbox()
|
|||
bboxdata.first_extruder = print->get_tool_ordering().first_extruder();
|
||||
bboxdata.bed_type = bed_type_to_gcode_string(print->config().curr_bed_type.value);
|
||||
// get nozzle diameter
|
||||
auto opt_nozzle_diameters = print->config().option<ConfigOptionFloats>("nozzle_diameter");
|
||||
auto opt_nozzle_diameters = print->config().option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
if (opt_nozzle_diameters != nullptr)
|
||||
bboxdata.nozzle_diameter = float(opt_nozzle_diameters->get_at(bboxdata.first_extruder));
|
||||
//PrintObjectPtrs objects;
|
||||
|
@ -9944,7 +9944,7 @@ void Plater::_calib_pa_pattern(const Calib_Params ¶ms)
|
|||
|
||||
const DynamicPrintConfig &printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
DynamicPrintConfig & print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
float nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
|
||||
float nozzle_diameter = printer_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->get_at(0);
|
||||
|
||||
for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) {
|
||||
print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second));
|
||||
|
@ -9999,7 +9999,7 @@ void Plater::_calib_pa_tower(const Calib_Params ¶ms)
|
|||
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
const float nozzle_diameter = printer_config->option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
|
||||
const float nozzle_diameter = printer_config->option<ConfigOptionFloatsNullable>("nozzle_diameter")->get_at(0);
|
||||
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionInts{1});
|
||||
//print_config->set_key_value("default_jerk", new ConfigOptionFloat(1.0f));
|
||||
|
@ -10008,8 +10008,8 @@ void Plater::_calib_pa_tower(const Calib_Params ¶ms)
|
|||
auto full_config = wxGetApp().preset_bundle->full_config();
|
||||
auto wall_speed = CalibPressureAdvance::find_optimal_PA_speed(full_config, full_config.get_abs_value("line_width"),
|
||||
full_config.get_abs_value("layer_height"), 0, 0);
|
||||
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(wall_speed));
|
||||
print_config->set_key_value("inner_wall_speed", new ConfigOptionFloat(wall_speed));
|
||||
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloatsNullable({wall_speed}));
|
||||
print_config->set_key_value("inner_wall_speed", new ConfigOptionFloatsNullable({wall_speed}));
|
||||
// print_config->set_key_value("wall_generator", new ConfigOptionEnum<PerimeterGeneratorType>(PerimeterGeneratorType::Classic));
|
||||
const auto _wall_generator = print_config->option<ConfigOptionEnum<PerimeterGeneratorType>>("wall_generator");
|
||||
if (_wall_generator->value == PerimeterGeneratorType::Arachne) print_config->set_key_value("wall_transition_angle", new ConfigOptionFloat(25));
|
||||
|
@ -10072,7 +10072,7 @@ void Plater::calib_flowrate(int pass)
|
|||
|
||||
/// --- scale ---
|
||||
// model is created for a 0.4 nozzle, scale z with nozzle size.
|
||||
const ConfigOptionFloats *nozzle_diameter_config = printerConfig->option<ConfigOptionFloats>("nozzle_diameter");
|
||||
const ConfigOptionFloatsNullable *nozzle_diameter_config = printerConfig->option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
assert(nozzle_diameter_config->values.size() > 0);
|
||||
float nozzle_diameter = nozzle_diameter_config->values[0];
|
||||
float xyScale = nozzle_diameter / 0.6;
|
||||
|
@ -10090,10 +10090,10 @@ void Plater::calib_flowrate(int pass)
|
|||
}
|
||||
|
||||
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
|
||||
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
|
||||
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed")->get_at(0);
|
||||
double max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
|
||||
double internal_solid_speed = std::floor(std::min(print_config->opt_float("internal_solid_infill_speed", 0), max_infill_speed));
|
||||
double top_surface_speed = std::floor(std::min(print_config->opt_float("top_surface_speed", 0), max_infill_speed));
|
||||
double internal_solid_speed = std::floor(std::min(print_config->opt_float_nullable("internal_solid_infill_speed", 0), max_infill_speed));
|
||||
double top_surface_speed = std::floor(std::min(print_config->opt_float_nullable("top_surface_speed", 0), max_infill_speed));
|
||||
|
||||
// adjust parameters
|
||||
for (auto _obj : model().objects) {
|
||||
|
@ -10178,8 +10178,8 @@ void Plater::calib_temp(const Calib_Params ¶ms)
|
|||
add_model(false, Slic3r::resources_dir() + "/calib/temperature_tower/temperature_tower.stl");
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
auto start_temp = lround(params.start);
|
||||
filament_config->set_key_value("nozzle_temperature_initial_layer", new ConfigOptionInts(1, (int) start_temp));
|
||||
filament_config->set_key_value("nozzle_temperature", new ConfigOptionInts(1, (int) start_temp));
|
||||
filament_config->set_key_value("nozzle_temperature_initial_layer", new ConfigOptionIntsNullable(1, (int) start_temp));
|
||||
filament_config->set_key_value("nozzle_temperature", new ConfigOptionIntsNullable(1, (int) start_temp));
|
||||
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
|
||||
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(5.0));
|
||||
model().objects[0]->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0));
|
||||
|
@ -10246,19 +10246,19 @@ void Plater::calib_max_vol_speed(const Calib_Params ¶ms)
|
|||
auto scale_obj = (bed_ext.size().x() - 10) / obj->bounding_box().size().x();
|
||||
if (scale_obj < 1.0) obj->scale(scale_obj, 1, 1);
|
||||
|
||||
const ConfigOptionFloats *nozzle_diameter_config = printer_config->option<ConfigOptionFloats>("nozzle_diameter");
|
||||
const ConfigOptionFloatsNullable *nozzle_diameter_config = printer_config->option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
assert(nozzle_diameter_config->values.size() > 0);
|
||||
double nozzle_diameter = nozzle_diameter_config->values[0];
|
||||
double line_width = nozzle_diameter * 1.75;
|
||||
double layer_height = nozzle_diameter * 0.8;
|
||||
|
||||
auto max_lh = printer_config->option<ConfigOptionFloats>("max_layer_height");
|
||||
auto max_lh = printer_config->option<ConfigOptionFloatsNullable>("max_layer_height");
|
||||
if (max_lh->values[0] < layer_height) max_lh->values[0] = {layer_height};
|
||||
|
||||
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{200});
|
||||
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloatsNullable{200});
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionInts{0});
|
||||
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBoolsNullable{false});
|
||||
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
|
@ -10324,7 +10324,7 @@ void Plater::calib_retraction(const Calib_Params ¶ms)
|
|||
|
||||
double layer_height = 0.2;
|
||||
|
||||
auto max_lh = printer_config->option<ConfigOptionFloats>("max_layer_height");
|
||||
auto max_lh = printer_config->option<ConfigOptionFloatsNullable>("max_layer_height");
|
||||
if (max_lh->values[0] < layer_height) max_lh->values[0] = {layer_height};
|
||||
|
||||
obj->config.set_key_value("wall_loops", new ConfigOptionInt(2));
|
||||
|
@ -10369,8 +10369,8 @@ void Plater::calib_VFA(const Calib_Params ¶ms)
|
|||
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionInts{0});
|
||||
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{200});
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
|
||||
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloatsNullable{200});
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBoolsNullable{false});
|
||||
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
|
@ -12511,7 +12511,7 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
|
|||
|
||||
// get type and color for platedata
|
||||
auto* filament_color = dynamic_cast<const ConfigOptionStrings*>(cfg.option("filament_colour"));
|
||||
auto* nozzle_diameter_option = dynamic_cast<const ConfigOptionFloats*>(cfg.option("nozzle_diameter"));
|
||||
auto* nozzle_diameter_option = dynamic_cast<const ConfigOptionFloatsNullable*>(cfg.option("nozzle_diameter"));
|
||||
auto* filament_id_opt = dynamic_cast<const ConfigOptionStrings*>(cfg.option("filament_ids"));
|
||||
std::string nozzle_diameter_str;
|
||||
if (nozzle_diameter_option)
|
||||
|
|
|
@ -1951,7 +1951,7 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_)
|
|||
// try color and type mapping
|
||||
|
||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_filament_maps();
|
||||
|
||||
int filament_result = 0;
|
||||
|
@ -2609,7 +2609,7 @@ bool SelectMachineDialog::is_same_nozzle_diameters(std::string& tag_nozzle_type,
|
|||
try
|
||||
{
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
auto opt_nozzle_diameters = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
auto opt_nozzle_diameters = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
|
||||
const ConfigOptionEnum<NozzleType>* nozzle_type = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<NozzleType>>("nozzle_type");
|
||||
|
||||
|
@ -3878,7 +3878,7 @@ void SelectMachineDialog::update_show_status()
|
|||
}
|
||||
|
||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
if (!m_mapping_popup.m_supporting_mix_print && nozzle_nums == 1)
|
||||
{
|
||||
bool useAms = false;
|
||||
|
@ -4336,7 +4336,7 @@ void SelectMachineDialog::reset_and_sync_ams_list()
|
|||
|
||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
const auto& extra_flush_volumes = get_min_flush_volumes(full_config, 0); // todo multi_extruder: always display nozzle 1
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
|
||||
bool use_double_extruder = nozzle_nums > 1 ? true : false;
|
||||
if (use_double_extruder)
|
||||
|
@ -4396,7 +4396,7 @@ void SelectMachineDialog::reset_and_sync_ams_list()
|
|||
if (!dev_manager) return;
|
||||
MachineObject *obj_ = dev_manager->get_selected_machine();
|
||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||
if (nozzle_nums > 1)
|
||||
{
|
||||
if (is_two_nozzle_same())
|
||||
|
|
|
@ -1525,8 +1525,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
}
|
||||
|
||||
if(opt_key=="layer_height"){
|
||||
auto min_layer_height_from_nozzle=m_preset_bundle->full_config().option<ConfigOptionFloats>("min_layer_height")->values;
|
||||
auto max_layer_height_from_nozzle=m_preset_bundle->full_config().option<ConfigOptionFloats>("max_layer_height")->values;
|
||||
auto min_layer_height_from_nozzle=m_preset_bundle->full_config().option<ConfigOptionFloatsNullable>("min_layer_height")->values;
|
||||
auto max_layer_height_from_nozzle=m_preset_bundle->full_config().option<ConfigOptionFloatsNullable>("max_layer_height")->values;
|
||||
auto layer_height_floor = *std::min_element(min_layer_height_from_nozzle.begin(), min_layer_height_from_nozzle.end());
|
||||
auto layer_height_ceil = *std::max_element(max_layer_height_from_nozzle.begin(), max_layer_height_from_nozzle.end());
|
||||
float layer_height = m_config->opt_float("layer_height");
|
||||
|
@ -1646,7 +1646,7 @@ void Tab::update_wiping_button_visibility() {
|
|||
if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA)
|
||||
return; // ys_FIXME
|
||||
bool wipe_tower_enabled = dynamic_cast<ConfigOptionBool*>( (m_preset_bundle->prints.get_edited_preset().config ).option("enable_prime_tower"))->value;
|
||||
bool multiple_extruders = dynamic_cast<ConfigOptionFloats*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1;
|
||||
bool multiple_extruders = dynamic_cast<ConfigOptionFloatsNullable*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1;
|
||||
|
||||
auto wiping_dialog_button = wxGetApp().sidebar().get_wiping_dialog_button();
|
||||
if (wiping_dialog_button) {
|
||||
|
@ -3092,7 +3092,7 @@ void TabFilament::update_filament_overrides_page()
|
|||
const int extruder_idx = m_variant_combo->GetSelection(); // #ys_FIXME
|
||||
|
||||
const bool have_retract_length = dynamic_cast<ConfigOptionVectorBase *>(m_config->option("filament_retraction_length"))->is_nil(extruder_idx) ||
|
||||
m_config->opt_float("filament_retraction_length", extruder_idx) > 0;
|
||||
m_config->opt_float_nullable("filament_retraction_length", extruder_idx) > 0;
|
||||
|
||||
for (const std::string& opt_key : opt_keys)
|
||||
{
|
||||
|
@ -3113,7 +3113,7 @@ void TabFilament::update_filament_overrides_page()
|
|||
else if (opt_key == "filament_retraction_distances_when_cut") {
|
||||
int machine_enabled_level = m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionInt>("enable_long_retraction_when_cut")->value;
|
||||
bool machine_enabled = machine_enabled_level == LongRectrationLevel::EnableFilament;
|
||||
bool filament_enabled = m_config->option<ConfigOptionBools>("filament_long_retractions_when_cut")->values[extruder_idx] == 1;
|
||||
bool filament_enabled = m_config->option<ConfigOptionBoolsNullable>("filament_long_retractions_when_cut")->values[extruder_idx] == 1;
|
||||
toggle_line(opt_key, filament_enabled && machine_enabled, extruder_idx + 256);
|
||||
field->toggle(is_checked && filament_enabled && machine_enabled);
|
||||
}
|
||||
|
@ -3523,7 +3523,7 @@ void TabPrinter::build_fff()
|
|||
// to avoid redundant memory allocation / deallocation during extruders count changing
|
||||
m_pages.reserve(30);
|
||||
|
||||
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(m_config->option("nozzle_diameter"));
|
||||
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloatsNullable*>(m_config->option("nozzle_diameter"));
|
||||
m_initial_extruders_count = m_extruders_count = nozzle_diameter->values.size();
|
||||
// BBS
|
||||
//wxGetApp().obj_list()->update_objects_list_filament_column(m_initial_extruders_count);
|
||||
|
@ -3531,7 +3531,7 @@ void TabPrinter::build_fff()
|
|||
const Preset* parent_preset = m_printer_technology == ptSLA ? nullptr // just for first build, if SLA printer preset is selected
|
||||
: m_presets->get_selected_preset_parent();
|
||||
m_sys_extruders_count = parent_preset == nullptr ? 0 :
|
||||
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
|
||||
static_cast<const ConfigOptionFloatsNullable*>(parent_preset->config.option("nozzle_diameter"))->values.size();
|
||||
|
||||
auto page = add_options_page(L("Basic information"), "printer");
|
||||
auto optgroup = page->new_optgroup(L("Printable space")/*, L"param_printable_space"*/);
|
||||
|
@ -4182,7 +4182,7 @@ void TabPrinter::on_preset_loaded()
|
|||
}
|
||||
|
||||
// update the extruders count field
|
||||
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(m_config->option("nozzle_diameter"));
|
||||
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloatsNullable*>(m_config->option("nozzle_diameter"));
|
||||
size_t extruders_count = nozzle_diameter->values.size();
|
||||
// update the GUI field according to the number of nozzle diameters supplied
|
||||
if (m_extruders_count != extruders_count)
|
||||
|
@ -4308,7 +4308,7 @@ void TabPrinter::toggle_options()
|
|||
{
|
||||
size_t i = size_t(val - 1);
|
||||
int variant_index = get_index_for_extruder(i);
|
||||
bool have_retract_length = m_config->opt_float("retraction_length", variant_index) > 0;
|
||||
bool have_retract_length = m_config->opt_float_nullable("retraction_length", variant_index) > 0;
|
||||
|
||||
//BBS
|
||||
for (auto el : { "extruder_type" , "nozzle_diameter"}) {
|
||||
|
@ -4340,7 +4340,7 @@ void TabPrinter::toggle_options()
|
|||
//BBS
|
||||
toggle_option(el, retraction && !use_firmware_retraction, i);
|
||||
|
||||
bool wipe = retraction && m_config->opt_bool("wipe", i);
|
||||
bool wipe = retraction && m_config->opt_bool_nullable("wipe", i);
|
||||
toggle_option("retract_before_wipe", wipe, i);
|
||||
|
||||
if (use_firmware_retraction && wipe) {
|
||||
|
@ -4352,7 +4352,7 @@ void TabPrinter::toggle_options()
|
|||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
auto wipe = static_cast<ConfigOptionBools*>(m_config->option("wipe")->clone());
|
||||
auto wipe = static_cast<ConfigOptionBoolsNullable*>(m_config->option("wipe")->clone());
|
||||
for (size_t w = 0; w < wipe->values.size(); w++)
|
||||
wipe->values[w] = false;
|
||||
new_conf.set_key_value("wipe", wipe);
|
||||
|
@ -4368,11 +4368,11 @@ void TabPrinter::toggle_options()
|
|||
|
||||
toggle_option("retract_length_toolchange", have_multiple_extruders, i);
|
||||
|
||||
bool toolchange_retraction = m_config->opt_float("retract_length_toolchange", variant_index) > 0;
|
||||
bool toolchange_retraction = m_config->opt_float_nullable("retract_length_toolchange", variant_index) > 0;
|
||||
toggle_option("retract_restart_extra_toolchange", have_multiple_extruders && toolchange_retraction, i);
|
||||
|
||||
toggle_option("long_retractions_when_cut", !use_firmware_retraction && m_config->opt_int("enable_long_retraction_when_cut"), i);
|
||||
toggle_line("retraction_distances_when_cut", m_config->opt_bool("long_retractions_when_cut", variant_index), i);
|
||||
toggle_line("retraction_distances_when_cut", m_config->opt_bool_nullable("long_retractions_when_cut", variant_index), i);
|
||||
}
|
||||
|
||||
if (m_active_page->title() == "Motion ability") {
|
||||
|
@ -4541,10 +4541,10 @@ void Tab::load_current_preset()
|
|||
}
|
||||
on_presets_changed();
|
||||
if (printer_technology == ptFFF) {
|
||||
static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<const ConfigOptionFloats*>(m_presets->get_selected_preset().config.option("nozzle_diameter"))->values.size(); //static_cast<TabPrinter*>(this)->m_extruders_count;
|
||||
static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<const ConfigOptionFloatsNullable*>(m_presets->get_selected_preset().config.option("nozzle_diameter"))->values.size(); //static_cast<TabPrinter*>(this)->m_extruders_count;
|
||||
const Preset* parent_preset = m_presets->get_selected_preset_parent();
|
||||
static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
|
||||
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
|
||||
static_cast<const ConfigOptionFloatsNullable*>(parent_preset->config.option("nozzle_diameter"))->values.size();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -5817,7 +5817,7 @@ void TabPrinter::cache_extruder_cnt()
|
|||
return;
|
||||
|
||||
// BBS. Get extruder count from preset instead of m_extruders_count.
|
||||
m_cache_extruder_count = dynamic_cast<ConfigOptionFloats*>((m_presets->get_edited_preset().config).option("nozzle_diameter"))->values.size();
|
||||
m_cache_extruder_count = dynamic_cast<ConfigOptionFloatsNullable*>((m_presets->get_edited_preset().config).option("nozzle_diameter"))->values.size();
|
||||
}
|
||||
|
||||
bool TabPrinter::apply_extruder_cnt_from_cache()
|
||||
|
|
|
@ -108,7 +108,7 @@ static bool is_same_nozzle_diameters(const DynamicPrintConfig &full_config, cons
|
|||
nozzle_type = "stainless_steel";
|
||||
}
|
||||
|
||||
auto opt_nozzle_diameters = full_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
auto opt_nozzle_diameters = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
if (opt_nozzle_diameters != nullptr) {
|
||||
float preset_nozzle_diameter = opt_nozzle_diameters->get_at(0);
|
||||
if (preset_nozzle_diameter != obj->m_nozzle_data.nozzles[0].diameter) {
|
||||
|
@ -536,7 +536,7 @@ bool CalibUtils::calib_flowrate(int pass, const CalibInfo &calib_info, wxString
|
|||
|
||||
/// --- scale ---
|
||||
// model is created for a 0.4 nozzle, scale z with nozzle size.
|
||||
const ConfigOptionFloats *nozzle_diameter_config = printer_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
const ConfigOptionFloatsNullable *nozzle_diameter_config = printer_config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
assert(nozzle_diameter_config->values.size() > 0);
|
||||
float nozzle_diameter = nozzle_diameter_config->values[0];
|
||||
float xyScale = nozzle_diameter / 0.6;
|
||||
|
@ -555,10 +555,10 @@ bool CalibUtils::calib_flowrate(int pass, const CalibInfo &calib_info, wxString
|
|||
//}
|
||||
|
||||
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
|
||||
double filament_max_volumetric_speed = filament_config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
|
||||
double filament_max_volumetric_speed = filament_config.option<ConfigOptionFloatsNullable>("filament_max_volumetric_speed")->get_at(0);
|
||||
double max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
|
||||
double internal_solid_speed = std::floor(std::min(print_config.opt_float("internal_solid_infill_speed", calib_info.extruder_id), max_infill_speed));
|
||||
double top_surface_speed = std::floor(std::min(print_config.opt_float("top_surface_speed", calib_info.extruder_id), max_infill_speed));
|
||||
double internal_solid_speed = std::floor(std::min(print_config.opt_float_nullable("internal_solid_infill_speed", calib_info.extruder_id), max_infill_speed));
|
||||
double top_surface_speed = std::floor(std::min(print_config.opt_float_nullable("top_surface_speed", calib_info.extruder_id), max_infill_speed));
|
||||
|
||||
// adjust parameters
|
||||
filament_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(calib_info.bed_type));
|
||||
|
@ -650,7 +650,7 @@ void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model)
|
|||
full_config.apply(filament_config);
|
||||
full_config.apply(printer_config);
|
||||
|
||||
float nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
|
||||
float nozzle_diameter = printer_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->get_at(0);
|
||||
|
||||
for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) {
|
||||
print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second));
|
||||
|
@ -744,7 +744,7 @@ bool CalibUtils::calib_generic_PA(const CalibInfo &calib_info, wxString &error_m
|
|||
else if (params.mode == CalibMode::Calib_PA_Pattern)
|
||||
js["cali_type"] = "cali_pa_pattern";
|
||||
|
||||
const ConfigOptionFloats *nozzle_diameter_config = printer_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
const ConfigOptionFloatsNullable *nozzle_diameter_config = printer_config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
assert(nozzle_diameter_config->values.size() > 0);
|
||||
float nozzle_diameter = nozzle_diameter_config->values[0];
|
||||
|
||||
|
@ -807,8 +807,8 @@ void CalibUtils::calib_temptue(const CalibInfo &calib_info, wxString &error_mess
|
|||
DynamicPrintConfig printer_config = calib_info.printer_prest->config;
|
||||
|
||||
auto start_temp = lround(params.start);
|
||||
filament_config.set_key_value("nozzle_temperature_initial_layer", new ConfigOptionInts(1, (int) start_temp));
|
||||
filament_config.set_key_value("nozzle_temperature", new ConfigOptionInts(1, (int) start_temp));
|
||||
filament_config.set_key_value("nozzle_temperature_initial_layer", new ConfigOptionIntsNullable(1, (int) start_temp));
|
||||
filament_config.set_key_value("nozzle_temperature", new ConfigOptionIntsNullable(1, (int) start_temp));
|
||||
filament_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(calib_info.bed_type));
|
||||
|
||||
model.objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
|
||||
|
@ -851,20 +851,20 @@ void CalibUtils::calib_max_vol_speed(const CalibInfo &calib_info, wxString &erro
|
|||
if (scale_obj < 1.0)
|
||||
obj->scale(scale_obj, 1, 1);
|
||||
|
||||
const ConfigOptionFloats *nozzle_diameter_config = printer_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
const ConfigOptionFloatsNullable *nozzle_diameter_config = printer_config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
|
||||
assert(nozzle_diameter_config->values.size() > 0);
|
||||
double nozzle_diameter = nozzle_diameter_config->values[0];
|
||||
double line_width = nozzle_diameter * 1.75;
|
||||
double layer_height = nozzle_diameter * 0.8;
|
||||
|
||||
auto max_lh = printer_config.option<ConfigOptionFloats>("max_layer_height");
|
||||
auto max_lh = printer_config.option<ConfigOptionFloatsNullable>("max_layer_height");
|
||||
if (max_lh->values[0] < layer_height) max_lh->values[0] = {layer_height};
|
||||
|
||||
filament_config.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{50});
|
||||
filament_config.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloatsNullable{50});
|
||||
filament_config.set_key_value("slow_down_layer_time", new ConfigOptionInts{0});
|
||||
filament_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(calib_info.bed_type));
|
||||
|
||||
print_config.set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
|
||||
print_config.set_key_value("enable_overhang_speed", new ConfigOptionBoolsNullable{false});
|
||||
print_config.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config.set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config.set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
|
@ -924,10 +924,10 @@ void CalibUtils::calib_VFA(const CalibInfo &calib_info, wxString &error_message)
|
|||
DynamicPrintConfig printer_config = calib_info.printer_prest->config;
|
||||
|
||||
filament_config.set_key_value("slow_down_layer_time", new ConfigOptionInts{0});
|
||||
filament_config.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{200});
|
||||
filament_config.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloatsNullable{200});
|
||||
filament_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(calib_info.bed_type));
|
||||
|
||||
print_config.set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
|
||||
print_config.set_key_value("enable_overhang_speed", new ConfigOptionBoolsNullable{false});
|
||||
print_config.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config.set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config.set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
|
@ -985,7 +985,7 @@ void CalibUtils::calib_retraction(const CalibInfo &calib_info, wxString &error_m
|
|||
|
||||
double layer_height = 0.2;
|
||||
|
||||
auto max_lh = printer_config.option<ConfigOptionFloats>("max_layer_height");
|
||||
auto max_lh = printer_config.option<ConfigOptionFloatsNullable>("max_layer_height");
|
||||
if (max_lh->values[0] < layer_height) max_lh->values[0] = {layer_height};
|
||||
|
||||
filament_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(calib_info.bed_type));
|
||||
|
|
Loading…
Reference in New Issue