diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 256750a6b0..a32c174c46 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -685,6 +685,32 @@ bool ConfigBase::set_deserialize_raw(const t_config_option_key &opt_key_src, con return success; } +double ConfigBase::get_abs_value_at(const t_config_option_key &opt_key, size_t index) const +{ + const ConfigOption *raw_opt = this->option(opt_key); + assert(raw_opt != nullptr); + if (raw_opt->type() == coFloats) { + return static_cast(raw_opt)->get_at(index); + } + if (raw_opt->type() == coFloatsOrPercents) { + const ConfigDef *def = this->def(); + if (def == nullptr) throw NoDefinitionException(opt_key); + const ConfigOptionDef *opt_def = def->get(opt_key); + assert(opt_def != nullptr); + + if (opt_def->ratio_over.empty()) { + return 0; + } else { + const ConfigOption *ratio_opt = this->option(opt_def->ratio_over); + assert(ratio_opt->type() == coFloats); + const ConfigOptionFloats *ratio_values = static_cast(ratio_opt); + return static_cast(raw_opt)->get_at(index).get_abs_value(ratio_values->get_at(index)); + } + } + + throw ConfigurationError("ConfigBase::get_abs_value_at(): Not a valid option type for get_abs_value_at()"); +} + // Return an absolute value of a possibly relative config variable. // For example, return absolute infill extrusion width, either from an absolute value, or relative to the layer height. double ConfigBase::get_abs_value(const t_config_option_key &opt_key) const diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 3e5201d089..0704fc3756 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -30,8 +30,14 @@ namespace Slic3r { struct FloatOrPercent { - double value; - bool percent; + double value = 0; + bool percent = false; + + FloatOrPercent() {} + FloatOrPercent(double value_, bool percent_) : value(value_), percent(percent_) { } + + double get_abs_value(double ratio_over) const { return this->percent ? (ratio_over * this->value / 100) : this->value; } + private: friend class cereal::access; template void serialize(Archive& ar) { ar(this->value); ar(this->percent); } @@ -2726,6 +2732,7 @@ public: void set_deserialize_strict(std::initializer_list items) { ConfigSubstitutionContext ctxt{ ForwardCompatibilitySubstitutionRule::Disable }; this->set_deserialize(items, ctxt); } + double get_abs_value_at(const t_config_option_key &opt_key, size_t index) const; double get_abs_value(const t_config_option_key &opt_key) const; double get_abs_value(const t_config_option_key &opt_key, double ratio_over) const; void setenv_() const; diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index d47518bbca..ad7e380c2f 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -957,11 +957,11 @@ std::vector group_fills(const Layer &layer, LockRegionParam &lock_p // record speed params if (!params.bridge) { if (params.extrusion_role == erInternalInfill) - params.sparse_infill_speed = region_config.sparse_infill_speed; + params.sparse_infill_speed = region_config.sparse_infill_speed.get_at(layer.get_extruder_id(params.extruder)); else if (params.extrusion_role == erTopSolidInfill) { - params.top_surface_speed = region_config.top_surface_speed; + params.top_surface_speed = region_config.top_surface_speed.get_at(layer.get_extruder_id(params.extruder)); } else if (params.extrusion_role == erSolidInfill) - params.solid_infill_speed = region_config.internal_solid_infill_speed; + params.solid_infill_speed = region_config.internal_solid_infill_speed.get_at(layer.get_extruder_id(params.extruder)); } // Calculate flow spacing for infill pattern generation. if (surface.is_solid() || is_bridge) { diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 1b2294144d..4af8a3c2ae 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -515,7 +515,7 @@ static std::vector get_path_of_change_filament(const Print& print) outer_wall_line_width = default_line_width == 0.0 ? filament_diameter : default_line_width; } Flow outer_wall_flow = Flow(outer_wall_line_width, config.layer_height, config.nozzle_diameter.get_at(extruder_id)); - float outer_wall_speed = print.default_region_config().outer_wall_speed.value; + float outer_wall_speed = print.default_region_config().outer_wall_speed.get_at(extruder_id); outer_wall_volumetric_speed = outer_wall_speed * outer_wall_flow.mm3_per_mm(); if (outer_wall_volumetric_speed > filament_max_volumetric_speed) outer_wall_volumetric_speed = filament_max_volumetric_speed; @@ -1602,6 +1602,7 @@ static std::vector get_path_of_change_filament(const Print& print) #define EXTRUDER_CONFIG(OPT) m_config.OPT.get_at(m_writer.filament()->extruder_id()) #define FILAMENT_CONFIG(OPT) m_config.OPT.get_at(m_writer.filament()->id()) +#define NOZZLE_CONFIG(OPT) m_config.OPT.get_at(cur_extruder_index()) void GCode::PlaceholderParserIntegration::reset() { @@ -2772,11 +2773,11 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato print.throw_if_canceled(); - m_cooling_buffer = make_unique(*this); - m_cooling_buffer->set_current_extruder(initial_extruder_id); - int extruder_id = get_extruder_id(initial_extruder_id); + m_cooling_buffer = make_unique(*this); + m_cooling_buffer->set_current_extruder(initial_extruder_id, extruder_id); + // Orca: Initialise AdaptivePA processor filter m_pa_processor = std::make_unique(*this, tool_ordering.all_extruders()); @@ -3199,12 +3200,12 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato if (print.calib_params().mode == CalibMode::Calib_PA_Line) { std::string gcode; gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change) + "\n"; - if ((print.default_object_config().outer_wall_acceleration.value > 0 && print.default_object_config().outer_wall_acceleration.value > 0)) { - gcode += m_writer.set_print_acceleration((unsigned int)floor(print.default_object_config().outer_wall_acceleration.value + 0.5)); + if ((NOZZLE_CONFIG(outer_wall_acceleration) > 0 && NOZZLE_CONFIG(outer_wall_acceleration) > 0)) { + gcode += m_writer.set_print_acceleration((unsigned int)floor(NOZZLE_CONFIG(outer_wall_acceleration) + 0.5)); } - if (print.default_object_config().outer_wall_jerk.value > 0) { - double jerk = print.default_object_config().outer_wall_jerk.value; + if (NOZZLE_CONFIG(outer_wall_jerk) > 0) { + double jerk = NOZZLE_CONFIG(outer_wall_jerk); gcode += m_writer.set_jerk_xy(jerk); } @@ -3287,8 +3288,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato file.writeln(printing_by_object_gcode); } // Reset the cooling buffer internal state (the current position, feed rate, accelerations). + m_cooling_buffer->set_current_extruder(initial_extruder_id, get_extruder_id(initial_extruder_id)); m_cooling_buffer->reset(this->writer().get_position()); - m_cooling_buffer->set_current_extruder(initial_extruder_id); // Process all layers of a single object instance (sequential mode) with a parallel pipeline: // Generate G-code, run the filters (vase mode, cooling buffer), run the G-code analyser // and export G-code into file. @@ -4384,10 +4385,10 @@ std::string GCode::generate_skirt(const Print &print, if (first_layer && i==loops.first) { //set skirt start point location const Point desired_start_point = Skirt::find_start_point(loop, skirt_start_angle); - gcode += this->extrude_loop(loop, "skirt", m_config.support_speed.value, {}, &desired_start_point); + gcode += this->extrude_loop(loop, "skirt", NOZZLE_CONFIG(support_speed), {}, &desired_start_point); } else - gcode += this->extrude_loop(loop, "skirt", m_config.support_speed.value); + gcode += this->extrude_loop(loop, "skirt", NOZZLE_CONFIG(support_speed)); // If we only want a single wall on non-first layers, break now if (!first_layer && print.m_config.single_loop_draft_shield) { @@ -4634,16 +4635,16 @@ LayerResult GCode::process_layer( //BBS if (first_layer) { // Orca: we don't need to optimize the Klipper as only set once - if (m_config.default_acceleration.value > 0 && m_config.initial_layer_acceleration.value > 0) { - gcode += m_writer.set_print_acceleration((unsigned int)floor(m_config.initial_layer_acceleration.value + 0.5)); + if (NOZZLE_CONFIG(default_acceleration) > 0 && NOZZLE_CONFIG(initial_layer_acceleration) > 0) { + gcode += m_writer.set_print_acceleration((unsigned int)floor(NOZZLE_CONFIG(initial_layer_acceleration) + 0.5)); } - if (m_config.default_jerk.value > 0 && m_config.initial_layer_jerk.value > 0) { - gcode += m_writer.set_jerk_xy(m_config.initial_layer_jerk.value); + if (NOZZLE_CONFIG(default_jerk) > 0 && NOZZLE_CONFIG(initial_layer_jerk) > 0) { + gcode += m_writer.set_jerk_xy(NOZZLE_CONFIG(initial_layer_jerk)); } - if (m_writer.get_gcode_flavor() == gcfMarlinFirmware && m_config.default_junction_deviation.value > 0) { - gcode += m_writer.set_junction_deviation(m_config.default_junction_deviation.value); + if (m_writer.get_gcode_flavor() == gcfMarlinFirmware && NOZZLE_CONFIG(default_junction_deviation) > 0) { + gcode += m_writer.set_junction_deviation(NOZZLE_CONFIG(default_junction_deviation)); } } @@ -4664,12 +4665,12 @@ LayerResult GCode::process_layer( } // Reset acceleration at sencond layer // Orca: only set once, don't need to call set_accel_and_jerk - if (m_config.default_acceleration.value > 0 && m_config.initial_layer_acceleration.value > 0) { - gcode += m_writer.set_print_acceleration((unsigned int) floor(m_config.default_acceleration.value + 0.5)); + if (NOZZLE_CONFIG(default_acceleration) > 0 && NOZZLE_CONFIG(initial_layer_acceleration) > 0) { + gcode += m_writer.set_print_acceleration((unsigned int) floor(NOZZLE_CONFIG(default_acceleration) + 0.5)); } - if (m_config.default_jerk.value > 0 && m_config.initial_layer_jerk.value > 0) { - gcode += m_writer.set_jerk_xy(m_config.default_jerk.value); + if (NOZZLE_CONFIG(default_jerk) > 0 && NOZZLE_CONFIG(initial_layer_jerk) > 0) { + gcode += m_writer.set_jerk_xy(NOZZLE_CONFIG(default_jerk)); } // Transition from 1st to 2nd layer. Adjust nozzle temperatures as prescribed by the nozzle dependent @@ -4724,8 +4725,8 @@ LayerResult GCode::process_layer( for (const auto &layer_to_print : layers) { if (layer_to_print.object_layer) { const auto& regions = layer_to_print.object_layer->regions(); - const bool enable_overhang_speed = std::any_of(regions.begin(), regions.end(), [](const LayerRegion* r) { - return r->has_extrusions() && r->region().config().enable_overhang_speed; + const bool enable_overhang_speed = std::any_of(regions.begin(), regions.end(), [this](const LayerRegion* r) { + return r->has_extrusions() && r->region().config().enable_overhang_speed.get_at(cur_extruder_index()); }); if (enable_overhang_speed) { m_extrusion_quality_estimator.prepare_for_new_layer(layer_to_print.original_object, @@ -5106,7 +5107,7 @@ LayerResult GCode::process_layer( this->set_origin(0., 0.); for (const ExtrusionEntity* ee : it->second.entities) if (ee != nullptr) - gcode += this->extrude_entity(*ee, "brim", m_config.support_speed.value); + gcode += this->extrude_entity(*ee, "brim", NOZZLE_CONFIG(support_speed)); // Mark brim as printed for this object to avoid per-object brim emission later. this->m_objsWithBrim.erase(unified_object_id); @@ -5317,7 +5318,7 @@ LayerResult GCode::process_layer( this->set_origin(0., 0.); m_avoid_crossing_perimeters.use_external_mp(); for (const ExtrusionEntity* ee : print.m_supportBrimMap.at(instance_to_print.print_object.id()).entities) { - gcode += this->extrude_entity(*ee, "brim", m_config.support_speed.value); + gcode += this->extrude_entity(*ee, "brim", NOZZLE_CONFIG(support_speed)); } m_avoid_crossing_perimeters.use_external_mp(false); // Allow a straight travel move to the first object point. @@ -5364,7 +5365,7 @@ LayerResult GCode::process_layer( this->set_origin(0., 0.); m_avoid_crossing_perimeters.use_external_mp(); for (const ExtrusionEntity* ee : print.m_brimMap.at(instance_to_print.print_object.id()).entities) { - gcode += this->extrude_entity(*ee, "brim", m_config.support_speed.value); + gcode += this->extrude_entity(*ee, "brim", NOZZLE_CONFIG(support_speed)); } m_avoid_crossing_perimeters.use_external_mp(false); // Allow a straight travel move to the first object point. @@ -5742,11 +5743,11 @@ std::string GCode::extrude_loop(const ExtrusionLoop& loop_ref, // SoftFever: check loop lenght for small perimeter. double small_peri_speed = -1; - if (speed == -1 && loop.length() <= SMALL_PERIMETER_LENGTH(m_config.small_perimeter_threshold.value)) { - if(m_config.small_perimeter_speed == 0) - small_peri_speed = m_config.outer_wall_speed * 0.5; + if (speed == -1 && loop.length() <= SMALL_PERIMETER_LENGTH(NOZZLE_CONFIG(small_perimeter_threshold))) { + if(NOZZLE_CONFIG(small_perimeter_speed).value == 0) + small_peri_speed = NOZZLE_CONFIG(outer_wall_speed) * 0.5; else - small_peri_speed = m_config.small_perimeter_speed.get_abs_value(m_config.outer_wall_speed); + small_peri_speed = NOZZLE_CONFIG(small_perimeter_speed).get_abs_value(NOZZLE_CONFIG(outer_wall_speed)); } // extrude along the path @@ -6128,8 +6129,8 @@ std::string GCode::extrude_support(const ExtrusionEntityCollection &support_fill chain_and_reorder_extrusion_entities(extrusions, m_last_pos.to_point()); - const double support_speed = m_config.support_speed.value; - const double support_interface_speed = m_config.get_abs_value("support_interface_speed"); + //const double support_speed = m_config.support_speed.value; + //const double support_interface_speed = m_config.get_abs_value("support_interface_speed"); for (const ExtrusionEntity *ee : extrusions) { ExtrusionRole role = ee->role(); assert(role == erSupportMaterial || role == erSupportMaterialInterface || role == erSupportTransition || role == erIroning); @@ -6340,47 +6341,47 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, unsigned int acceleration_i = 0; double jerk = 0; // adjust acceleration - if (m_config.default_acceleration.value > 0) { + if (NOZZLE_CONFIG(default_acceleration) > 0) { double acceleration; - if (this->on_first_layer() && m_config.initial_layer_acceleration.value > 0) { - acceleration = m_config.initial_layer_acceleration.value; + if (this->on_first_layer() && NOZZLE_CONFIG(initial_layer_acceleration) > 0) { + acceleration = NOZZLE_CONFIG(initial_layer_acceleration); #if 0 } else if (this->object_layer_over_raft() && m_config.first_layer_acceleration_over_raft.value > 0) { acceleration = m_config.first_layer_acceleration_over_raft.value; #endif - } else if (m_config.get_abs_value("bridge_acceleration") > 0 && is_bridge(path.role())) { - acceleration = m_config.get_abs_value("bridge_acceleration"); - } else if (m_config.get_abs_value("sparse_infill_acceleration") > 0 && (path.role() == erInternalInfill)) { - acceleration = m_config.get_abs_value("sparse_infill_acceleration"); - } else if (m_config.get_abs_value("internal_solid_infill_acceleration") > 0 && (path.role() == erSolidInfill)) { - acceleration = m_config.get_abs_value("internal_solid_infill_acceleration"); - } else if (m_config.outer_wall_acceleration.value > 0 && is_external_perimeter(path.role())) { - acceleration = m_config.outer_wall_acceleration.value; - } else if (m_config.inner_wall_acceleration.value > 0 && is_internal_perimeter(path.role())) { - acceleration = m_config.inner_wall_acceleration.value; - } else if (m_config.top_surface_acceleration.value > 0 && is_top_surface(path.role())) { - acceleration = m_config.top_surface_acceleration.value; + } else if (m_config.get_abs_value_at("bridge_acceleration", cur_extruder_index()) > 0 && is_bridge(path.role())) { + acceleration = m_config.get_abs_value_at("bridge_acceleration", cur_extruder_index()); + } else if (m_config.get_abs_value_at("sparse_infill_acceleration", cur_extruder_index()) > 0 && (path.role() == erInternalInfill)) { + acceleration = m_config.get_abs_value_at("sparse_infill_acceleration", cur_extruder_index()); + } else if (m_config.get_abs_value_at("internal_solid_infill_acceleration", cur_extruder_index()) > 0 && (path.role() == erSolidInfill)) { + acceleration = m_config.get_abs_value_at("internal_solid_infill_acceleration", cur_extruder_index()); + } else if (NOZZLE_CONFIG(outer_wall_acceleration) > 0 && is_external_perimeter(path.role())) { + acceleration = NOZZLE_CONFIG(outer_wall_acceleration); + } else if (NOZZLE_CONFIG(inner_wall_acceleration) > 0 && is_internal_perimeter(path.role())) { + acceleration = NOZZLE_CONFIG(inner_wall_acceleration); + } else if (NOZZLE_CONFIG(top_surface_acceleration) > 0 && is_top_surface(path.role())) { + acceleration = NOZZLE_CONFIG(top_surface_acceleration); } else { - acceleration = m_config.default_acceleration.value; + acceleration = NOZZLE_CONFIG(default_acceleration); } acceleration_i = (unsigned int)floor(acceleration + 0.5); } // adjust X Y jerk - if (m_config.default_jerk.value > 0) { - if (this->on_first_layer() && m_config.initial_layer_jerk.value > 0) { - jerk = m_config.initial_layer_jerk.value; - } else if (m_config.outer_wall_jerk.value > 0 && is_external_perimeter(path.role())) { - jerk = m_config.outer_wall_jerk.value; - } else if (m_config.inner_wall_jerk.value > 0 && is_internal_perimeter(path.role())) { - jerk = m_config.inner_wall_jerk.value; - } else if (m_config.top_surface_jerk.value > 0 && is_top_surface(path.role())) { - jerk = m_config.top_surface_jerk.value; - } else if (m_config.infill_jerk.value > 0 && is_infill(path.role())) { - jerk = m_config.infill_jerk.value; + if (NOZZLE_CONFIG(default_jerk) > 0) { + if (this->on_first_layer() && NOZZLE_CONFIG(initial_layer_jerk) > 0) { + jerk = NOZZLE_CONFIG(initial_layer_jerk); + } else if (NOZZLE_CONFIG(outer_wall_jerk) > 0 && is_external_perimeter(path.role())) { + jerk = NOZZLE_CONFIG(outer_wall_jerk); + } else if (NOZZLE_CONFIG(inner_wall_jerk) > 0 && is_internal_perimeter(path.role())) { + jerk = NOZZLE_CONFIG(inner_wall_jerk); + } else if (NOZZLE_CONFIG(top_surface_jerk) > 0 && is_top_surface(path.role())) { + jerk = NOZZLE_CONFIG(top_surface_jerk); + } else if (NOZZLE_CONFIG(infill_jerk) > 0 && is_infill(path.role())) { + jerk = NOZZLE_CONFIG(infill_jerk); } else { - jerk = m_config.default_jerk.value; + jerk = NOZZLE_CONFIG(default_jerk); } } @@ -6443,37 +6444,37 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, // set speed if (speed == -1) { if (path.role() == erPerimeter) { - speed = m_config.inner_wall_speed.get_at(cur_extruder_index()); + speed = NOZZLE_CONFIG(inner_wall_speed); if (sloped) { speed = std::min(speed, m_config.scarf_joint_speed.get_abs_value(speed)); } } else if (path.role() == erExternalPerimeter) { - speed = m_config.get_abs_value("outer_wall_speed"); + speed = NOZZLE_CONFIG(outer_wall_speed); if (sloped) { speed = std::min(speed, m_config.scarf_joint_speed.get_abs_value(speed)); } } else if(path.role() == erInternalBridgeInfill) { - speed = m_config.get_abs_value("internal_bridge_speed"); + speed = m_config.get_abs_value_at("internal_bridge_speed", cur_extruder_index()); } else if (path.role() == erOverhangPerimeter || path.role() == erSupportTransition || path.role() == erBridgeInfill) { - speed = m_config.get_abs_value("bridge_speed"); + speed = NOZZLE_CONFIG(bridge_speed); } else if (path.role() == erInternalInfill) { - speed = m_config.get_abs_value("sparse_infill_speed"); + speed = NOZZLE_CONFIG(sparse_infill_speed); } else if (path.role() == erSolidInfill) { - speed = m_config.get_abs_value("internal_solid_infill_speed"); + speed = NOZZLE_CONFIG(internal_solid_infill_speed); } else if (path.role() == erTopSolidInfill) { - speed = m_config.get_abs_value("top_surface_speed"); + speed = NOZZLE_CONFIG(top_surface_speed); } else if (path.role() == erIroning) { speed = m_config.get_abs_value("ironing_speed"); } else if (path.role() == erBottomSurface) { - speed = m_config.get_abs_value("initial_layer_infill_speed"); + speed = NOZZLE_CONFIG(initial_layer_infill_speed); } else if (path.role() == erGapFill) { - speed = m_config.get_abs_value("gap_infill_speed"); + speed = NOZZLE_CONFIG(gap_infill_speed); } else if (path.role() == erSupportMaterial || path.role() == erSupportMaterialInterface) { - const double support_speed = m_config.support_speed.value; - const double support_interface_speed = m_config.get_abs_value("support_interface_speed"); + const double support_speed = NOZZLE_CONFIG(support_speed); + const double support_interface_speed = NOZZLE_CONFIG(support_interface_speed); speed = (path.role() == erSupportMaterial) ? support_speed : support_interface_speed; } else { throw Slic3r::InvalidArgument("Invalid speed"); @@ -6494,16 +6495,16 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, //BBS: for solid infill of first layer, speed can be higher as long as //wall lines have be attached if (path.role() != erBottomSurface) { - speed = is_perimeter(path.role()) ? m_config.get_abs_value("initial_layer_speed") : - m_config.get_abs_value("initial_layer_infill_speed"); + speed = is_perimeter(path.role()) ? NOZZLE_CONFIG(initial_layer_speed) : + NOZZLE_CONFIG(initial_layer_infill_speed); } } else if (m_config.slow_down_layers > 1 && m_config.raft_layers == 0) { if (_layer > 0 && _layer < m_config.slow_down_layers) { const auto first_layer_speed = is_perimeter(path.role()) - ? m_config.get_abs_value("initial_layer_speed") - : m_config.get_abs_value("initial_layer_infill_speed"); + ? NOZZLE_CONFIG(initial_layer_speed) + : NOZZLE_CONFIG(initial_layer_infill_speed); if (first_layer_speed < speed) { speed = std::min( speed, @@ -6515,8 +6516,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, if (_layer > m_config.raft_layers && (_layer - m_config.raft_layers) < m_config.slow_down_layers) { const auto first_layer_speed - = is_perimeter(path.role()) ? m_config.get_abs_value("initial_layer_speed") : - m_config.get_abs_value("initial_layer_infill_speed"); + = is_perimeter(path.role()) ? NOZZLE_CONFIG(initial_layer_speed) : + NOZZLE_CONFIG(initial_layer_infill_speed); if (first_layer_speed < speed) { speed = std::min(speed, Slic3r::lerp(first_layer_speed, speed, (double) (_layer - m_config.raft_layers) / m_config.slow_down_layers)); @@ -6582,10 +6583,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, bool variable_speed = false; std::vector new_points {}; - if (m_config.enable_overhang_speed && !this->on_first_layer() && !object_layer_over_raft() && + if (NOZZLE_CONFIG(enable_overhang_speed) && !this->on_first_layer() && !object_layer_over_raft() && (is_bridge(path.role()) || is_perimeter(path.role()))) { bool is_external = is_external_perimeter(path.role()); - double ref_speed = is_external ? m_config.get_abs_value("outer_wall_speed") : m_config.inner_wall_speed.get_at(cur_extruder_index()); + double ref_speed = is_external ? NOZZLE_CONFIG(outer_wall_speed) : NOZZLE_CONFIG(inner_wall_speed); if (ref_speed == 0) ref_speed = FILAMENT_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm; @@ -6598,46 +6599,46 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, ConfigOptionPercents overhang_overlap_levels({90, 75, 50, 25, 13, 0}); - if (m_config.slowdown_for_curled_perimeters){ + if (NOZZLE_CONFIG(slowdown_for_curled_perimeters)){ ConfigOptionFloatsOrPercents dynamic_overhang_speeds( {FloatOrPercent{100, true}, - (m_config.get_abs_value("overhang_1_4_speed", ref_speed) < 0.5) ? + (NOZZLE_CONFIG(overhang_1_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_1_4_speed", ref_speed) * 100 / ref_speed, true}, - (m_config.get_abs_value("overhang_2_4_speed", ref_speed) < 0.5) ? + FloatOrPercent{NOZZLE_CONFIG(overhang_1_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + (NOZZLE_CONFIG(overhang_2_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_2_4_speed", ref_speed) * 100 / ref_speed, true}, - (m_config.get_abs_value("overhang_3_4_speed", ref_speed) < 0.5) ? + FloatOrPercent{NOZZLE_CONFIG(overhang_2_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + (NOZZLE_CONFIG(overhang_3_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_3_4_speed", ref_speed) * 100 / ref_speed, true}, - (m_config.get_abs_value("overhang_4_4_speed", ref_speed) < 0.5) ? + FloatOrPercent{NOZZLE_CONFIG(overhang_3_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed", ref_speed) * 100 / ref_speed, true}, - (m_config.get_abs_value("overhang_4_4_speed", ref_speed) < 0.5) ? + FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed", ref_speed) * 100 / ref_speed, true}}); + FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}}); new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds, - ref_speed, speed, m_config.slowdown_for_curled_perimeters); + ref_speed, speed, NOZZLE_CONFIG(slowdown_for_curled_perimeters)); }else{ ConfigOptionFloatsOrPercents dynamic_overhang_speeds( {FloatOrPercent{100, true}, - (m_config.get_abs_value("overhang_1_4_speed", ref_speed) < 0.5) ? + (NOZZLE_CONFIG(overhang_1_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_1_4_speed", ref_speed) * 100 / ref_speed, true}, - (m_config.get_abs_value("overhang_2_4_speed", ref_speed) < 0.5) ? + FloatOrPercent{NOZZLE_CONFIG(overhang_1_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + (NOZZLE_CONFIG(overhang_2_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_2_4_speed", ref_speed) * 100 / ref_speed, true}, - (m_config.get_abs_value("overhang_3_4_speed", ref_speed) < 0.5) ? + FloatOrPercent{NOZZLE_CONFIG(overhang_2_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + (NOZZLE_CONFIG(overhang_3_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_3_4_speed", ref_speed) * 100 / ref_speed, true}, - (m_config.get_abs_value("overhang_4_4_speed", ref_speed) < 0.5) ? + FloatOrPercent{NOZZLE_CONFIG(overhang_3_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed", ref_speed) * 100 / ref_speed, true}, - FloatOrPercent{m_config.get_abs_value("bridge_speed") * 100 / ref_speed, true}}); + FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, + FloatOrPercent{NOZZLE_CONFIG(bridge_speed) * 100 / ref_speed, true}}); new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds, - ref_speed, speed, m_config.slowdown_for_curled_perimeters); + ref_speed, speed, NOZZLE_CONFIG(slowdown_for_curled_perimeters)); } variable_speed = std::any_of(new_points.begin(), new_points.end(), [speed](const ProcessedPoint &p) { return fabs(double(p.speed) - speed) > 1; }); // Ignore small speed variations (under 1mm/sec) @@ -7296,40 +7297,40 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string unsigned int acceleration_to_set = 0; if (this->on_first_layer()) { - unsigned int initial_layer_travel_acceleration = m_config.get_abs_value("initial_layer_travel_acceleration"); - double initial_layer_travel_jerk = m_config.get_abs_value("initial_layer_travel_jerk"); + unsigned int initial_layer_travel_acceleration = m_config.get_abs_value_at("initial_layer_travel_acceleration", cur_extruder_index()); + double initial_layer_travel_jerk = m_config.get_abs_value_at("initial_layer_travel_jerk", cur_extruder_index()); - if (m_config.default_acceleration.value > 0 && initial_layer_travel_acceleration > 0) { + if (NOZZLE_CONFIG(default_acceleration) > 0 && initial_layer_travel_acceleration > 0) { acceleration_to_set = (unsigned int) floor(initial_layer_travel_acceleration + 0.5); } - if (m_config.default_jerk.value > 0 && initial_layer_travel_jerk > 0) { + if (NOZZLE_CONFIG(default_jerk)> 0 && initial_layer_travel_jerk > 0) { jerk_to_set = initial_layer_travel_jerk; } } else { // ORCA: Handle short-travel acceleration and jerk for outer perimeters (if applicable) const bool is_short_travel = travel.length() < scale_(EXTRUDER_CONFIG(retraction_minimum_travel)); - if (m_config.default_acceleration.value > 0) { + if (NOZZLE_CONFIG(default_acceleration) > 0) { if (role == erOverhangPerimeter && is_short_travel) { - const double bridge_acceleration = m_config.get_abs_value("bridge_acceleration"); + const double bridge_acceleration = m_config.get_abs_value_at("bridge_acceleration", cur_extruder_index()); if (bridge_acceleration > 0) acceleration_to_set = (unsigned int) floor(bridge_acceleration + 0.5); } else if (role == erExternalPerimeter && is_short_travel) { - if (m_config.outer_wall_acceleration.value > 0) - acceleration_to_set = (unsigned int) floor(m_config.outer_wall_acceleration.value + 0.5); + if (NOZZLE_CONFIG(outer_wall_acceleration) > 0) + acceleration_to_set = (unsigned int) floor(NOZZLE_CONFIG(outer_wall_acceleration) + 0.5); } else { - if (m_config.travel_acceleration.value > 0) - acceleration_to_set = (unsigned int) floor(m_config.travel_acceleration.value + 0.5); + if (NOZZLE_CONFIG(travel_acceleration) > 0) + acceleration_to_set = (unsigned int) floor(NOZZLE_CONFIG(travel_acceleration) + 0.5); } } - if (m_config.default_jerk.value > 0) { + if (NOZZLE_CONFIG(default_jerk) > 0) { if ((role == erExternalPerimeter || role == erOverhangPerimeter) && is_short_travel) { - if (m_config.outer_wall_jerk.value > 0) - jerk_to_set = m_config.outer_wall_jerk.value; + if (NOZZLE_CONFIG(outer_wall_jerk) > 0) + jerk_to_set = NOZZLE_CONFIG(outer_wall_jerk); } else { - if (m_config.travel_jerk.value > 0) - jerk_to_set = m_config.travel_jerk.value; + if (NOZZLE_CONFIG(travel_jerk) > 0) + jerk_to_set = NOZZLE_CONFIG(travel_jerk); } } } diff --git a/src/libslic3r/GCode/CoolingBuffer.cpp b/src/libslic3r/GCode/CoolingBuffer.cpp index 8cfb99a46b..edcf60cdb6 100644 --- a/src/libslic3r/GCode/CoolingBuffer.cpp +++ b/src/libslic3r/GCode/CoolingBuffer.cpp @@ -18,7 +18,7 @@ namespace Slic3r { -CoolingBuffer::CoolingBuffer(GCode &gcodegen) : m_config(gcodegen.config()), m_toolchange_prefix(gcodegen.writer().toolchange_prefix()), m_current_extruder(0) +CoolingBuffer::CoolingBuffer(GCode &gcodegen) : m_config(gcodegen.config()), m_toolchange_prefix(gcodegen.writer().toolchange_prefix()), m_current_extruder(0), m_current_nozzle(0) { this->reset(gcodegen.writer().get_position()); @@ -37,7 +37,7 @@ void CoolingBuffer::reset(const Vec3d &position) m_current_pos[0] = float(position.x()); m_current_pos[1] = float(position.y()); m_current_pos[2] = float(position.z()); - m_current_pos[4] = float(m_config.travel_speed.value); + m_current_pos[4] = float(m_config.travel_speed.get_at(m_current_nozzle)); m_fan_speed = -1; m_additional_fan_speed = -1; m_current_fan_speed = -1; diff --git a/src/libslic3r/GCode/CoolingBuffer.hpp b/src/libslic3r/GCode/CoolingBuffer.hpp index fba27b289b..9b0a5ab9df 100644 --- a/src/libslic3r/GCode/CoolingBuffer.hpp +++ b/src/libslic3r/GCode/CoolingBuffer.hpp @@ -25,7 +25,7 @@ class CoolingBuffer { public: CoolingBuffer(GCode &gcodegen); void reset(const Vec3d &position); - void set_current_extruder(unsigned int extruder_id) { m_current_extruder = extruder_id; } + void set_current_extruder(unsigned int extruder_id, unsigned int nozzle_id) { m_current_extruder = extruder_id; m_current_nozzle = nozzle_id; } std::string process_layer(std::string &&gcode, size_t layer_id, bool flush); private: @@ -55,6 +55,7 @@ private: // the PrintConfig slice of FullPrintConfig is constant, thus no thread synchronization is required. const PrintConfig &m_config; unsigned int m_current_extruder; + unsigned int m_current_nozzle; //BBS: current fan speed int m_current_fan_speed; }; diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 43ee7f92e4..7d0a89b994 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -1472,7 +1472,7 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi m_bridging(10.f), m_no_sparse_layers(config.wipe_tower_no_sparse_layers), m_gcode_flavor(config.gcode_flavor), - m_travel_speed(config.travel_speed), + m_travel_speed(config.travel_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool))), m_current_tool(initial_tool), //wipe_volumes(flush_matrix) m_enable_timelapse_print(config.timelapse_type.value == TimelapseType::tlSmooth), @@ -1497,7 +1497,7 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi // it is taken over following default. Speeds from config are not // easily accessible here. const float default_speed = 60.f; - m_first_layer_speed = config.get_abs_value("initial_layer_speed"); + m_first_layer_speed = config.initial_layer_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool)); if (m_first_layer_speed == 0.f) // just to make sure autospeed doesn't break it. m_first_layer_speed = default_speed / 2.f; diff --git a/src/libslic3r/GCode/WipeTower2.cpp b/src/libslic3r/GCode/WipeTower2.cpp index 2efe3fb0f9..7950034bb1 100644 --- a/src/libslic3r/GCode/WipeTower2.cpp +++ b/src/libslic3r/GCode/WipeTower2.cpp @@ -1262,8 +1262,8 @@ WipeTower2::WipeTower2(const PrintConfig& config, const PrintRegionConfig& defau m_bridging(float(config.wipe_tower_bridging)), m_no_sparse_layers(config.wipe_tower_no_sparse_layers), m_gcode_flavor(config.gcode_flavor), - m_travel_speed(config.travel_speed), - m_infill_speed(default_region_config.sparse_infill_speed), + m_travel_speed(config.travel_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool))), + m_infill_speed(default_region_config.sparse_infill_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool))), m_perimeter_speed(default_region_config.inner_wall_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool))), m_current_tool(initial_tool), wipe_volumes(wiping_matrix), m_wipe_tower_max_purge_speed(float(config.wipe_tower_max_purge_speed)), @@ -1280,7 +1280,7 @@ WipeTower2::WipeTower2(const PrintConfig& config, const PrintRegionConfig& defau // it is taken over following default. Speeds from config are not // easily accessible here. const float default_speed = 60.f; - m_first_layer_speed = config.initial_layer_speed; + m_first_layer_speed = config.initial_layer_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool)); if (m_first_layer_speed == 0.f) // just to make sure autospeed doesn't break it. m_first_layer_speed = default_speed / 2.f; diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 3029f1f89c..e3275cf411 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -610,7 +610,7 @@ std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &com GCodeG1Formatter w; w.emit_xy(point_on_plate); auto speed = m_is_first_layer - ? this->config.get_abs_value("initial_layer_travel_speed") : this->config.travel_speed.value; + ? this->config.get_abs_value_at("initial_layer_travel_speed", get_extruder_index(this->config, filament()->id())) : this->config.travel_speed.get_at(get_extruder_index(this->config, filament()->id())); w.emit_f(speed * 60.0); //BBS w.emit_comment(GCodeWriter::full_gcode_comment, comment); @@ -696,7 +696,7 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co // BBS Vec3d dest_point = point; auto travel_speed = - m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed") : this->config.travel_speed.value; + m_is_first_layer ? this->config.get_abs_value_at("initial_layer_travel_speed", get_extruder_index(this->config, filament()->id())) : this->config.travel_speed.get_at(get_extruder_index(this->config, filament()->id())); //BBS: a z_hop need to be handle when travel if (std::abs(m_to_lift) > EPSILON) { assert(std::abs(m_lifted) < EPSILON); @@ -793,13 +793,13 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co { //force to move xy first then z after filament change w.emit_xy(Vec2d(point_on_plate.x(), point_on_plate.y())); - w.emit_f(this->config.travel_speed.value * 60.0); + w.emit_f(this->config.travel_speed.get_at(get_extruder_index(this->config, filament()->id())) * 60.0); w.emit_comment(GCodeWriter::full_gcode_comment, comment); out_string = w.string() + _travel_to_z(point_on_plate.z(), comment); } else { GCodeG1Formatter w; w.emit_xyz(point_on_plate); - w.emit_f(this->config.travel_speed.value * 60.0); + w.emit_f(this->config.travel_speed.get_at(get_extruder_index(this->config, filament()->id())) * 60.0); w.emit_comment(GCodeWriter::full_gcode_comment, comment); out_string = w.string(); } @@ -832,10 +832,10 @@ std::string GCodeWriter::_travel_to_z(double z, const std::string &comment) { m_pos(2) = z; - double speed = this->config.travel_speed_z.value; + double speed = this->config.travel_speed_z.get_at(get_extruder_index(this->config, filament()->id())); if (speed == 0.) { - speed = m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed") - : this->config.travel_speed.value; + speed = m_is_first_layer ? this->config.get_abs_value_at("initial_layer_travel_speed", get_extruder_index(this->config, filament()->id())) + : this->config.travel_speed.get_at(get_extruder_index(this->config, filament()->id())); } GCodeG1Formatter w; @@ -849,11 +849,11 @@ std::string GCodeWriter::_travel_to_z(double z, const std::string &comment) std::string GCodeWriter::_spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment) { std::string output; - double speed = this->config.travel_speed_z.value; + double speed = this->config.travel_speed_z.get_at(get_extruder_index(this->config, filament()->id())); if (speed == 0.) { - speed = m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed") - : this->config.travel_speed.value; + speed = m_is_first_layer ? this->config.get_abs_value_at("initial_layer_travel_speed", get_extruder_index(this->config, filament()->id())) + : this->config.travel_speed.get_at(get_extruder_index(this->config, filament()->id())); } if (!this->config.enable_arc_fitting) { // Orca: if arc fitting is disabled, approximate the arc with small linear segments diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index fdf8f7fb98..4dc38a6656 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -146,9 +146,9 @@ bool Layer::is_perimeter_compatible(const Print& print, const PrintRegion& a, co && config.wall_sequence == other_config.wall_sequence && config.is_infill_first == other_config.is_infill_first && config.inner_wall_speed.get_at(print.get_extruder_id(config.wall_filament)) == other_config.inner_wall_speed.get_at(print.get_extruder_id(config.wall_filament)) - && config.outer_wall_speed == other_config.outer_wall_speed - && config.small_perimeter_speed == other_config.small_perimeter_speed - && config.gap_infill_speed.value == other_config.gap_infill_speed.value + && config.outer_wall_speed.get_at(print.get_extruder_id(config.wall_filament)) == other_config.outer_wall_speed.get_at(print.get_extruder_id(config.wall_filament)) + && config.small_perimeter_speed.get_at(print.get_extruder_id(config.wall_filament)) == other_config.small_perimeter_speed.get_at(print.get_extruder_id(config.wall_filament)) + && config.gap_infill_speed.get_at(print.get_extruder_id(config.wall_filament)) == other_config.gap_infill_speed.get_at(print.get_extruder_id(config.wall_filament)) && config.filter_out_gap_fill.value == other_config.filter_out_gap_fill.value && config.detect_overhang_wall == other_config.detect_overhang_wall && config.overhang_reverse == other_config.overhang_reverse diff --git a/src/libslic3r/MultiMaterialSegmentation.cpp b/src/libslic3r/MultiMaterialSegmentation.cpp index 4946ad45c8..f0cc1767ac 100644 --- a/src/libslic3r/MultiMaterialSegmentation.cpp +++ b/src/libslic3r/MultiMaterialSegmentation.cpp @@ -1352,7 +1352,7 @@ static inline std::vector> segmentation_top_and_bottom_l out.extrusion_width = std::max(out.extrusion_width, outer_wall_line_width); out.top_shell_layers = std::max(out.top_shell_layers, config.top_shell_layers); out.bottom_shell_layers = std::max(out.bottom_shell_layers, config.bottom_shell_layers); - out.small_region_threshold = config.gap_infill_speed.value > 0 ? + out.small_region_threshold = config.gap_infill_speed.get_at(print_object.print()->get_extruder_id(config.wall_filament - 1)) > 0 ? // Gap fill enabled. Enable a single line of 1/2 extrusion width. 0.5f * outer_wall_line_width : // Gap fill disabled. Enable two lines slightly overlapping. diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 0769fb76de..58fedf976f 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -581,7 +581,7 @@ void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExP coord_t ext_perimeter_width = this->ext_perimeter_flow.scaled_width(); coord_t ext_perimeter_spacing = this->ext_perimeter_flow.scaled_spacing(); - bool has_gap_fill = this->config->gap_infill_speed.value > 0; + bool has_gap_fill = this->config->gap_infill_speed.get_at(get_extruder_index(*print_config, this->config->wall_filament - 1)) > 0; // split the polygons with top/not_top // get the offset from solid surface anchor @@ -1189,7 +1189,7 @@ void PerimeterGenerator::process_classic() // internal flow which is unrelated. coord_t min_spacing = coord_t(perimeter_spacing * (1 - INSET_OVERLAP_TOLERANCE)); coord_t ext_min_spacing = coord_t(ext_perimeter_spacing * (1 - INSET_OVERLAP_TOLERANCE)); - bool has_gap_fill = this->config->gap_infill_speed.value > 0; + bool has_gap_fill = this->config->gap_infill_speed.get_at(get_extruder_index(*print_config, this->config->wall_filament - 1)) > 0; // BBS: this flow is for smaller external perimeter for small area coord_t ext_min_spacing_smaller = coord_t(ext_perimeter_spacing * (1 - SMALLER_EXT_INSET_OVERLAP_TOLERANCE)); diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index cab707b69d..5b51afc030 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1732,6 +1732,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* // check if print speed/accel/jerk is higher than the maximum speed of the printer if (warning) { try { + /* TODO: Orca: fix it auto check_motion_ability_object_setting = [&](const std::vector& keys_to_check, double limit) -> std::string { std::string warning_key; for (const auto& key : keys_to_check) { @@ -1759,12 +1760,15 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* // check jerk if (!ignore_jerk_validation) { - if (m_default_object_config.default_jerk == 1 || m_default_object_config.outer_wall_jerk == 1 || - m_default_object_config.inner_wall_jerk == 1) { + auto is_jerk_too_low = [](const ConfigOptionFloatsNullable& cfg) { + return std::any_of(cfg.values.begin(), cfg.values.end(), [](const float v) { return v == 1; }); + }; + if (is_jerk_too_low(m_default_object_config.default_jerk) || is_jerk_too_low(m_default_object_config.outer_wall_jerk) || + is_jerk_too_low(m_default_object_config.inner_wall_jerk)) { warning->string = L("Setting the jerk speed too low could lead to artifacts on curved surfaces"); - if (m_default_object_config.outer_wall_jerk == 1) + if (is_jerk_too_low(m_default_object_config.outer_wall_jerk)) warning_key = "outer_wall_jerk"; - else if (m_default_object_config.inner_wall_jerk == 1) + else if (is_jerk_too_low(m_default_object_config.inner_wall_jerk)) warning_key = "inner_wall_jerk"; else warning_key = "default_jerk"; @@ -1856,6 +1860,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* } } } + */ // check speed // Orca: disable the speed check for now as we don't cap the speed diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index c6bcc75510..72386563a3 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1497,14 +1497,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); - def = this->add("enable_overhang_speed", coBool); + def = this->add("enable_overhang_speed", coBools); def->label = L("Slow down for overhang"); def->category = L("Speed"); def->tooltip = L("Enable this option to slow printing down for different overhang degree."); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionBool{ true }); + def->nullable = true; + def->set_default_value(new ConfigOptionBoolsNullable{ true }); - def = this->add("slowdown_for_curled_perimeters", coBool); + def = this->add("slowdown_for_curled_perimeters", coBools); def->label = L("Slow down for curled perimeters"); def->category = L("Speed"); // xgettext:no-c-format, no-boost-format @@ -1519,9 +1520,10 @@ void PrintConfigDef::init_fff_params() "applied even if the overhanging perimeter is part of a bridge. For example, when the perimeters are 100% overhanging" ", with no wall supporting them from underneath, the 100% overhang speed will be applied."); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionBool{ true }); + def->nullable = true; + def->set_default_value(new ConfigOptionBoolsNullable{ true }); - def = this->add("overhang_1_4_speed", coFloatOrPercent); + def = this->add("overhang_1_4_speed", coFloatsOrPercents); def->label = "10%"; def->category = L("Speed"); def->full_label = "10%"; @@ -1531,9 +1533,10 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(0, false)}); - def = this->add("overhang_2_4_speed", coFloatOrPercent); + def = this->add("overhang_2_4_speed", coFloatsOrPercents); def->label = "25%"; def->category = L("Speed"); def->full_label = "25%"; @@ -1543,9 +1546,10 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(0, false)}); - def = this->add("overhang_3_4_speed", coFloatOrPercent); + def = this->add("overhang_3_4_speed", coFloatsOrPercents); def->label = "50%"; def->category = L("Speed"); def->full_label = "50%"; @@ -1555,9 +1559,10 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(0, false)}); - def = this->add("overhang_4_4_speed", coFloatOrPercent); + def = this->add("overhang_4_4_speed", coFloatsOrPercents); def->label = "75%"; def->category = L("Speed"); def->full_label = "75%"; @@ -1567,9 +1572,10 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "outer_wall_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(0, false)}); - def = this->add("bridge_speed", coFloat); + def = this->add("bridge_speed", coFloats); def->label = L("External"); def->category = L("Speed"); def->tooltip = L("Speed of the externally visible bridge extrusions.\n\n" @@ -1579,9 +1585,10 @@ void PrintConfigDef::init_fff_params() def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(25)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{25}); - def = this->add("internal_bridge_speed", coFloatOrPercent); + def = this->add("internal_bridge_speed", coFloatsOrPercents); def->label = L("Internal"); def->category = L("Speed"); def->tooltip = L("Speed of internal bridges. If the value is expressed as a percentage, it will be calculated based on the bridge_speed. Default value is 150%."); @@ -1589,7 +1596,8 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "bridge_speed"; def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(150, true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(150, true)}); def = this->add("brim_width", coFloat); def->label = L("Brim width"); @@ -1776,14 +1784,46 @@ void PrintConfigDef::init_fff_params() "This can improve the cooling quality for needle and small details."); def->set_default_value(new ConfigOptionBools { true }); - def = this->add("default_acceleration", coFloat); + def = this->add("default_acceleration", coFloats); def->label = L("Normal printing"); def->category = L("Speed"); def->tooltip = L("The default acceleration of both normal printing and travel except initial layer."); def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(500.0)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{500.0}); + + def = this->add("travel_acceleration", coFloats); + def->label = L("Travel"); + def->category = L("Speed"); + def->tooltip = L("Acceleration of travel moves."); + def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation + def->min = 0; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{10000.0}); + + def = this->add("initial_layer_travel_acceleration", coFloatsOrPercents); + def->label = L("First layer travel"); + def->tooltip = L("Travel acceleration of first layer.\nThe percentage value is relative to Travel Acceleration."); + def->sidetext = L("mm/s² or %"); + def->min = 0; + def->mode = comAdvanced; + def->ratio_over = "travel_acceleration"; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); + + def = this->add("bridge_acceleration", coFloatsOrPercents); + def->label = L("Bridge"); + def->category = L("Speed"); + def->tooltip = L("Acceleration of bridges. If the value is expressed as a percentage (e.g. 50%), it will be calculated based on the outer wall acceleration."); + def->sidetext = L("mm/s² or %"); + def->min = 0; + def->mode = comAdvanced; + def->ratio_over = "outer_wall_acceleration"; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(50,true)}); def = this->add("default_filament_profile", coStrings); def->label = L("Default filament profile"); @@ -2006,6 +2046,18 @@ void PrintConfigDef::init_fff_params() def->enum_labels.push_back(L("Octagram Spiral")); def->set_default_value(new ConfigOptionEnum(ipMonotonicLine)); + def = this->add("top_surface_density", coPercent); + def->label = L("Top surface density"); + def->category = L("Strength"); + def->tooltip = L("Density of top surface layer. A value of 100% creates a fully solid, smooth top layer. " + "Reducing this value results in a textured top surface, according to the chosen top surface pattern. " + "A value of 0% will result in only the walls on the top layer being created. " + "Intended for aesthetic or functional purposes, not to fix issues such as over-extrusion."); + def->sidetext = ("%"); + def->min = 0; + def->max = 100; + def->set_default_value(new ConfigOptionPercent(100)); + def = this->add("bottom_surface_pattern", coEnum); def->label = L("Bottom surface pattern"); def->category = L("Strength"); @@ -2015,6 +2067,17 @@ void PrintConfigDef::init_fff_params() def->enum_labels = def_top_fill_pattern->enum_labels; def->set_default_value(new ConfigOptionEnum(ipMonotonic)); + def = this->add("bottom_surface_density", coPercent); + def->label = L("Bottom surface density"); + def->category = L("Strength"); + def->tooltip = L("Density of the bottom surface layer. " + "Intended for aesthetic or functional purposes, not to fix issues such as over-extrusion.\n" + "WARNING: Lowering this value may negatively affect bed adhesion."); + def->sidetext = ("%"); + def->min = 10; + def->max = 100; + def->set_default_value(new ConfigOptionPercent(100)); + def = this->add("internal_solid_infill_pattern", coEnum); def->label = L("Internal solid infill pattern"); def->category = L("Strength"); @@ -2036,7 +2099,7 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(0., false)); - def = this->add("outer_wall_speed", coFloat); + def = this->add("outer_wall_speed", coFloats); def->label = L("Outer wall"); def->category = L("Speed"); def->tooltip = L("Speed of outer wall which is outermost and visible. " @@ -2044,9 +2107,10 @@ void PrintConfigDef::init_fff_params() def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(60)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{60}); - def = this->add("small_perimeter_speed", coFloatOrPercent); + def = this->add("small_perimeter_speed", coFloatsOrPercents); def->label = L("Small perimeters"); def->category = L("Speed"); def->tooltip = L("This separate setting will affect the speed of perimeters having radius <= small_perimeter_threshold " @@ -2056,16 +2120,18 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "outer_wall_speed"; def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(50, true)}); - def = this->add("small_perimeter_threshold", coFloat); + def = this->add("small_perimeter_threshold", coFloats); def->label = L("Small perimeters threshold"); def->category = L("Speed"); def->tooltip = L("This sets the threshold for small perimeter length. Default threshold is 0mm."); def->sidetext = L("mm"); // millimeters, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(0)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{0}); def = this->add("wall_sequence", coEnum); def->label = L("Walls printing order"); @@ -2427,18 +2493,6 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(fmmAutoForFlush)); - def = this->add("enable_filament_dynamic_map", coBool); - def->label = L("Enable filament dynamic map"); - def->tooltip = L("Enable dynamic filament mapping during print."); - def->mode = comDevelop; - def->set_default_value(new ConfigOptionBool(false)); - - def = this->add("has_filament_switcher", coBool); - def->label = L("Has filament switcher"); - def->tooltip = L("Printer has a filament switcher hardware (e.g., AMS)."); - def->mode = comDevelop; - def->set_default_value(new ConfigOptionBool(false)); - def = this->add("filament_flush_temp", coInts); def->label = L("Flush temperature"); def->tooltip = L("Temperature when flushing filament. 0 indicates the upper bound of the recommended nozzle temperature range."); @@ -2984,134 +3038,37 @@ void PrintConfigDef::init_fff_params() def->enum_labels.push_back(L("Octagram Spiral")); def->set_default_value(new ConfigOptionEnum(ipCrossHatch)); - def = this->add("lateral_lattice_angle_1", coFloat); - def->label = L("Lateral lattice angle 1"); - def->category = L("Strength"); - def->tooltip = L("The angle of the first set of Lateral lattice elements in the Z direction. Zero is vertical."); - def->sidetext = u8"°"; // degrees, don't need translation - def->min = -75; - def->max = 75; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(-45)); - - def = this->add("lateral_lattice_angle_2", coFloat); - def->label = L("Lateral lattice angle 2"); - def->category = L("Strength"); - def->tooltip = L("The angle of the second set of Lateral lattice elements in the Z direction. Zero is vertical."); - def->sidetext = u8"°"; // degrees, don't need translation - def->min = -75; - def->max = 75; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(45)); - - def = this->add("infill_overhang_angle", coFloat); - def->label = L("Infill overhang angle"); - def->category = L("Strength"); - def->tooltip = L("The angle of the infill angled lines. 60° will result in a pure honeycomb."); - def->sidetext = u8"°"; // degrees, don't need translation - def->min = 15; - def->max = 75; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(60)); - - auto def_infill_anchor_min = def = this->add("infill_anchor", coFloatOrPercent); - def->label = L("Sparse infill anchor length"); - def->category = L("Strength"); - def->tooltip = L("Connect an infill line to an internal perimeter with a short segment of an additional perimeter. " - "If expressed as percentage (example: 15%) it is calculated over infill extrusion width. " - "Orca Slicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment " - "shorter than infill_anchor_max is found, the infill line is connected to a perimeter segment at just one side " - "and the length of the perimeter segment taken is limited to this parameter, but no longer than anchor_length_max.\n" - "Set this parameter to zero to disable anchoring perimeters connected to a single infill line."); - def->sidetext = L("mm or %"); - def->ratio_over = "sparse_infill_line_width"; - def->max_literal = 1000; - def->gui_type = ConfigOptionDef::GUIType::f_enum_open; - def->enum_values.push_back("0"); - def->enum_values.push_back("1"); - def->enum_values.push_back("2"); - def->enum_values.push_back("5"); - def->enum_values.push_back("10"); - def->enum_values.push_back("1000"); - def->enum_labels.push_back(L("0 (no open anchors)")); - def->enum_labels.push_back("1 mm"); - def->enum_labels.push_back("2 mm"); - def->enum_labels.push_back("5 mm"); - def->enum_labels.push_back("10 mm"); - def->enum_labels.push_back(L("1000 (unlimited)")); - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(400, true)); - - def = this->add("infill_anchor_max", coFloatOrPercent); - def->label = L("Maximum length of the infill anchor"); - def->category = L("Strength"); - def->tooltip = L("Connect an infill line to an internal perimeter with a short segment of an additional perimeter. " - "If expressed as percentage (example: 15%) it is calculated over infill extrusion width. " - "Orca Slicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment " - "shorter than this parameter is found, the infill line is connected to a perimeter segment at just one side " - "and the length of the perimeter segment taken is limited to infill_anchor, but no longer than this parameter.\n" - "If set to 0, the old algorithm for infill connection will be used, it should create the same result as with 1000 & 0."); - def->sidetext = def_infill_anchor_min->sidetext; - def->ratio_over = def_infill_anchor_min->ratio_over; - def->gui_type = def_infill_anchor_min->gui_type; - def->enum_values = def_infill_anchor_min->enum_values; - def->max_literal = def_infill_anchor_min->max_literal; - def->enum_labels.push_back(L("0 (Simple connect)")); - def->enum_labels.push_back("1 mm"); - def->enum_labels.push_back("2 mm"); - def->enum_labels.push_back("5 mm"); - def->enum_labels.push_back("10 mm"); - def->enum_labels.push_back(L("1000 (unlimited)")); - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(20, false)); - - def = this->add("inner_wall_acceleration", coFloat); - def->label = L("Inner wall"); - def->category = L("Speed"); - def->tooltip = L("Acceleration of inner walls."); - def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation - def->min = 0; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(10000)); - - def = this->add("travel_acceleration", coFloat); - def->label = L("Travel"); - def->category = L("Speed"); - def->tooltip = L("Acceleration of travel moves."); - def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation - def->min = 0; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(10000)); - - def = this->add("top_surface_acceleration", coFloat); + def = this->add("top_surface_acceleration", coFloats); def->label = L("Top surface"); def->category = L("Speed"); def->tooltip = L("Acceleration of top surface infill. Using a lower value may improve top surface quality."); def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(500)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{500}); - def = this->add("outer_wall_acceleration", coFloat); + def = this->add("outer_wall_acceleration", coFloats); def->label = L("Outer wall"); def->category = L("Speed"); def->tooltip = L("Acceleration of outer wall. Using a lower value can improve quality."); def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(500)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{500}); - def = this->add("bridge_acceleration", coFloatOrPercent); - def->label = L("Bridge"); + def = this->add("inner_wall_acceleration", coFloats); + def->label = L("Inner wall"); def->category = L("Speed"); - def->tooltip = L("Acceleration of bridges. If the value is expressed as a percentage (e.g. 50%), it will be calculated based on the outer wall acceleration."); - def->sidetext = L("mm/s² or %"); + def->tooltip = L("Acceleration of inner walls."); + def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->ratio_over = "outer_wall_acceleration"; - def->set_default_value(new ConfigOptionFloatOrPercent(50,true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{10000}); - def = this->add("sparse_infill_acceleration", coFloatOrPercent); + def = this->add("sparse_infill_acceleration", coFloatsOrPercents); def->label = L("Sparse infill"); def->category = L("Speed"); def->tooltip = L("Acceleration of sparse infill. If the value is expressed as a percentage (e.g. 100%), it will be calculated based on the default acceleration."); @@ -3119,9 +3076,10 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->mode = comAdvanced; def->ratio_over = "default_acceleration"; - def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); - def = this->add("internal_solid_infill_acceleration", coFloatOrPercent); + def = this->add("internal_solid_infill_acceleration", coFloatsOrPercents); def->label = L("Internal solid infill"); def->category = L("Speed"); def->tooltip = L("Acceleration of internal solid infill. If the value is expressed as a percentage (e.g. 100%), it will be calculated based on the default acceleration."); @@ -3129,25 +3087,18 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->mode = comAdvanced; def->ratio_over = "default_acceleration"; - def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); - def = this->add("initial_layer_acceleration", coFloat); + def = this->add("initial_layer_acceleration", coFloats); def->label = L("First layer"); def->category = L("Speed"); def->tooltip = L("Acceleration of the first layer. Using a lower value can improve build plate adhesion."); def->sidetext = L(u8"mm/s²"); // millimeters per second per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(300)); - - def = this->add("initial_layer_travel_acceleration", coFloatOrPercent); - def->label = L("First layer travel"); - def->tooltip = L("Travel acceleration of first layer.\nThe percentage value is relative to Travel Acceleration."); - def->sidetext = L("mm/s² or %"); - def->min = 0; - def->mode = comAdvanced; - def->ratio_over = "travel_acceleration"; - def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{300}); def = this->add("accel_to_decel_enable", coBool); def->label = L("Enable accel_to_decel"); @@ -3166,16 +3117,17 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionPercent(50)); - def = this->add("default_jerk", coFloat); + def = this->add("default_jerk", coFloats); def->label = L("Default"); def->category = L("Speed"); def->tooltip = L("Default jerk."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(0)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{0}); - def = this->add("default_junction_deviation", coFloat); + def = this->add("default_junction_deviation", coFloats); def->label = L("Junction Deviation"); def->category = L("Speed"); def->tooltip = L("Marlin Firmware Junction Deviation (replaces the traditional XY Jerk setting)."); @@ -3183,70 +3135,78 @@ void PrintConfigDef::init_fff_params() def->min = 0.f; def->max = 0.3f; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(0.f)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{0.f}); - def = this->add("outer_wall_jerk", coFloat); + def = this->add("outer_wall_jerk", coFloats); def->label = L("Outer wall"); def->category = L("Speed"); def->tooltip = L("Jerk of outer walls."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(9)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{9}); - def = this->add("inner_wall_jerk", coFloat); + def = this->add("inner_wall_jerk", coFloats); def->label = L("Inner wall"); def->category = L("Speed"); def->tooltip = L("Jerk of inner walls."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(9)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{9}); - def = this->add("top_surface_jerk", coFloat); + def = this->add("top_surface_jerk", coFloats); def->label = L("Top surface"); def->category = L("Speed"); + def->nullable = true; def->tooltip = L("Jerk for top surface."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(9)); + def->set_default_value(new ConfigOptionFloatsNullable{9}); - def = this->add("infill_jerk", coFloat); + def = this->add("infill_jerk", coFloats); def->label = L("Infill"); def->category = L("Speed"); def->tooltip = L("Jerk for infill."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(9)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{9}); - def = this->add("initial_layer_jerk", coFloat); + def = this->add("initial_layer_jerk", coFloats); def->label = L("First layer"); def->category = L("Speed"); def->tooltip = L("Jerk for the first layer."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(9)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{9}); - def = this->add("travel_jerk", coFloat); + def = this->add("travel_jerk", coFloats); def->label = L("Travel"); def->category = L("Speed"); def->tooltip = L("Jerk for travel."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(12)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{12}); - def = this->add("initial_layer_travel_jerk", coFloatOrPercent); + def = this->add("initial_layer_travel_jerk", coFloatsOrPercents); def->label = L("First layer travel"); def->tooltip = L("Travel jerk of first layer.\nThe percentage value is relative to Travel Jerk."); def->sidetext = L("mm/s or %"); def->min = 0; def->mode = comAdvanced; def->ratio_over = "travel_jerk"; - def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); def = this->add("initial_layer_line_width", coFloatOrPercent); def->label = L("First layer"); @@ -3260,7 +3220,6 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(0., false)); - def = this->add("initial_layer_print_height", coFloat); def->label = L("First layer height"); def->category = L("Quality"); @@ -3277,23 +3236,25 @@ void PrintConfigDef::init_fff_params() // "Note that this option only takes effect if no prime tower is generated in current plate."); //def->set_default_value(new ConfigOptionBool(0)); - def = this->add("initial_layer_speed", coFloat); + def = this->add("initial_layer_speed", coFloats); def->label = L("First layer"); def->tooltip = L("Speed of the first layer except the solid infill part."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(30)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{30}); - def = this->add("initial_layer_infill_speed", coFloat); + def = this->add("initial_layer_infill_speed", coFloats); def->label = L("First layer infill"); def->tooltip = L("Speed of solid infill part of the first layer."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(60.0)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{60.0}); - def = this->add("initial_layer_travel_speed", coFloatOrPercent); + def = this->add("initial_layer_travel_speed", coFloatsOrPercents); def->label = L("First layer travel speed"); def->tooltip = L("Travel speed of the first layer."); def->category = L("Speed"); @@ -3301,7 +3262,8 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "travel_speed"; def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); def = this->add("slow_down_layers", coInt); def->label = L("Number of slow layers"); @@ -3584,14 +3546,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0)); - def = this->add("gap_infill_speed", coFloat); + def = this->add("gap_infill_speed", coFloats); def->label = L("Gap infill"); def->category = L("Speed"); def->tooltip = L("Speed of gap infill. Gap usually has irregular line width and should be printed more slowly."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(30)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{30}); // BBS def = this->add("precise_z_height", coBool); @@ -4004,6 +3967,87 @@ void PrintConfigDef::init_fff_params() def->gui_type = ConfigOptionDef::GUIType::one_string; def->set_default_value(new ConfigOptionPoints()); + def = this->add("lateral_lattice_angle_1", coFloat); + def->label = L("Lateral lattice angle 1"); + def->category = L("Strength"); + def->tooltip = L("The angle of the first set of Lateral lattice elements in the Z direction. Zero is vertical."); + def->sidetext = u8"°"; // degrees, don't need translation + def->min = -75; + def->max = 75; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(-45)); + + def = this->add("lateral_lattice_angle_2", coFloat); + def->label = L("Lateral lattice angle 2"); + def->category = L("Strength"); + def->tooltip = L("The angle of the second set of Lateral lattice elements in the Z direction. Zero is vertical."); + def->sidetext = u8"°"; // degrees, don't need translation + def->min = -75; + def->max = 75; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(45)); + + def = this->add("infill_overhang_angle", coFloat); + def->label = L("Infill overhang angle"); + def->category = L("Strength"); + def->tooltip = L("The angle of the infill angled lines. 60° will result in a pure honeycomb."); + def->sidetext = u8"°"; // degrees, don't need translation + def->min = 15; + def->max = 75; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(60)); + + auto def_infill_anchor_min = def = this->add("infill_anchor", coFloatOrPercent); + def->label = L("Sparse infill anchor length"); + def->category = L("Strength"); + def->tooltip = L("Connect an infill line to an internal perimeter with a short segment of an additional perimeter. " + "If expressed as percentage (example: 15%) it is calculated over infill extrusion width. " + "Orca Slicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment " + "shorter than infill_anchor_max is found, the infill line is connected to a perimeter segment at just one side " + "and the length of the perimeter segment taken is limited to this parameter, but no longer than anchor_length_max.\n" + "Set this parameter to zero to disable anchoring perimeters connected to a single infill line."); + def->sidetext = L("mm or %"); + def->ratio_over = "sparse_infill_line_width"; + def->max_literal = 1000; + def->gui_type = ConfigOptionDef::GUIType::f_enum_open; + def->enum_values.push_back("0"); + def->enum_values.push_back("1"); + def->enum_values.push_back("2"); + def->enum_values.push_back("5"); + def->enum_values.push_back("10"); + def->enum_values.push_back("1000"); + def->enum_labels.push_back(L("0 (no open anchors)")); + def->enum_labels.push_back("1 mm"); + def->enum_labels.push_back("2 mm"); + def->enum_labels.push_back("5 mm"); + def->enum_labels.push_back("10 mm"); + def->enum_labels.push_back(L("1000 (unlimited)")); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloatOrPercent(400, true)); + + def = this->add("infill_anchor_max", coFloatOrPercent); + def->label = L("Maximum length of the infill anchor"); + def->category = L("Strength"); + def->tooltip = L("Connect an infill line to an internal perimeter with a short segment of an additional perimeter. " + "If expressed as percentage (example: 15%) it is calculated over infill extrusion width. " + "Orca Slicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment " + "shorter than this parameter is found, the infill line is connected to a perimeter segment at just one side " + "and the length of the perimeter segment taken is limited to infill_anchor, but no longer than this parameter.\n" + "If set to 0, the old algorithm for infill connection will be used, it should create the same result as with 1000 & 0."); + def->sidetext = def_infill_anchor_min->sidetext; + def->ratio_over = def_infill_anchor_min->ratio_over; + def->gui_type = def_infill_anchor_min->gui_type; + def->enum_values = def_infill_anchor_min->enum_values; + def->max_literal = def_infill_anchor_min->max_literal; + def->enum_labels.push_back(L("0 (Simple connect)")); + def->enum_labels.push_back("1 mm"); + def->enum_labels.push_back("2 mm"); + def->enum_labels.push_back("5 mm"); + def->enum_labels.push_back("10 mm"); + def->enum_labels.push_back(L("1000 (unlimited)")); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloatOrPercent(20, false)); + def = this->add("sparse_infill_filament", coInt); def->gui_type = ConfigOptionDef::GUIType::i_enum_open; def->label = L("Infill"); @@ -4051,14 +4095,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionPercent(25)); - def = this->add("sparse_infill_speed", coFloat); + def = this->add("sparse_infill_speed", coFloats); def->label = L("Sparse infill"); def->category = L("Speed"); def->tooltip = L("Speed of internal sparse infill."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(100)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{100}); def = this->add("inherits", coString); def->label = L("Inherits profile"); @@ -5250,6 +5295,18 @@ void PrintConfigDef::init_fff_params() def->tooltip = "AMS counts per extruder."; def->set_default_value(new ConfigOptionStrings { }); + def = this->add("enable_filament_dynamic_map", coBool); + def->label = L("Enable filament dynamic map"); + def->tooltip = L("Enable dynamic filament mapping during print."); + def->mode = comDevelop; + def->set_default_value(new ConfigOptionBool(false)); + + def = this->add("has_filament_switcher", coBool); + def->label = L("Has filament switcher"); + def->tooltip = L("Printer has a filament switcher hardware (e.g., AMS)."); + def->mode = comDevelop; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("printer_extruder_id", coInts); // internal use only, don't need translation def->label = "Printer extruder id"; @@ -5667,14 +5724,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(0., false)); - def = this->add("internal_solid_infill_speed", coFloat); + def = this->add("internal_solid_infill_speed", coFloats); def->label = L("Internal solid infill"); def->category = L("Speed"); def->tooltip = L("Speed of internal solid infill, not the top and bottom surface."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(100)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{100}); def = this->add("spiral_mode", coBool); def->label = L("Spiral vase"); @@ -6122,14 +6180,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0.5)); - def = this->add("support_interface_speed", coFloat); + def = this->add("support_interface_speed", coFloats); def->label = L("Support interface"); def->category = L("Speed"); def->tooltip = L("Speed of support interface."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(80)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{80}); def = this->add("support_base_pattern", coEnum); def->label = L("Base pattern"); @@ -6193,14 +6252,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0)); - def = this->add("support_speed", coFloat); + def = this->add("support_speed", coFloats); def->label = L("Support"); def->category = L("Speed"); def->tooltip = L("Speed of support."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(80)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{ 80 }); def = this->add("support_style", coEnum); def->label = L("Style"); @@ -6553,14 +6613,15 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(0., false)); - def = this->add("top_surface_speed", coFloat); + def = this->add("top_surface_speed", coFloats); def->label = L("Top surface"); def->category = L("Speed"); def->tooltip = L("Speed of top surface infill which is solid."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(100)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{100}); def = this->add("top_shell_layers", coInt); def->label = L("Top shell layers"); @@ -6584,39 +6645,17 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->set_default_value(new ConfigOptionFloat(0.6)); - def = this->add("top_surface_density", coPercent); - def->label = L("Top surface density"); - def->category = L("Strength"); - def->tooltip = L("Density of top surface layer. A value of 100% creates a fully solid, smooth top layer. " - "Reducing this value results in a textured top surface, according to the chosen top surface pattern. " - "A value of 0% will result in only the walls on the top layer being created. " - "Intended for aesthetic or functional purposes, not to fix issues such as over-extrusion."); - def->sidetext = ("%"); - def->min = 0; - def->max = 100; - def->set_default_value(new ConfigOptionPercent(100)); - def = this->add("bottom_surface_density", coPercent); - def->label = L("Bottom surface density"); - def->category = L("Strength"); - def->tooltip = L("Density of the bottom surface layer. " - "Intended for aesthetic or functional purposes, not to fix issues such as over-extrusion.\n" - "WARNING: Lowering this value may negatively affect bed adhesion."); - def->sidetext = ("%"); - def->min = 10; - def->max = 100; - def->set_default_value(new ConfigOptionPercent(100)); - - - def = this->add("travel_speed", coFloat); + def = this->add("travel_speed", coFloats); def->label = L("Travel"); def->tooltip = L("Speed of travel which is faster and without extrusion."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(120)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{120}); - def = this->add("travel_speed_z", coFloat); + def = this->add("travel_speed_z", coFloats); //def->label = L("Z travel"); //def->tooltip = L("Speed of vertical travel along z axis. " // "This is typically lower because build plate or gantry is hard to be moved. " @@ -6624,7 +6663,8 @@ void PrintConfigDef::init_fff_params() def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 0; def->mode = comDevelop; - def->set_default_value(new ConfigOptionFloat(0.)); + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsNullable{0.}); def = this->add("wipe", coBools); def->label = L("Wipe while retracting"); @@ -8155,32 +8195,48 @@ const PrintConfigDef print_config_def; //todo std::set print_options_with_variant = { - //"initial_layer_speed", - //"initial_layer_infill_speed", - //"outer_wall_speed", + "initial_layer_speed", + "initial_layer_infill_speed", + "outer_wall_speed", "inner_wall_speed", - //"small_perimeter_speed", //coFloatsOrPercents - //"small_perimeter_threshold", - //"sparse_infill_speed", - //"internal_solid_infill_speed", - //"top_surface_speed", - //"enable_overhang_speed", //coBools - //"overhang_1_4_speed", - //"overhang_2_4_speed", - //"overhang_3_4_speed", - //"overhang_4_4_speed", - //"bridge_speed", - //"gap_infill_speed", - //"support_speed", - //"support_interface_speed", - //"travel_speed", - //"travel_speed_z", - //"default_acceleration", - //"initial_layer_acceleration", - //"outer_wall_acceleration", - //"inner_wall_acceleration", - //"sparse_infill_acceleration", //coFloatsOrPercents - //"top_surface_acceleration", + "small_perimeter_speed", //coFloatsOrPercents + "small_perimeter_threshold", + "sparse_infill_speed", + "internal_solid_infill_speed", + "top_surface_speed", + "enable_overhang_speed", //coBools + "overhang_1_4_speed", + "overhang_2_4_speed", + "overhang_3_4_speed", + "overhang_4_4_speed", + "slowdown_for_curled_perimeters", + "bridge_speed", + "internal_bridge_speed", + "gap_infill_speed", + "support_speed", + "support_interface_speed", + "travel_speed", + "travel_speed_z", + "initial_layer_travel_speed", + "default_acceleration", + "bridge_acceleration", + "travel_acceleration", + "initial_layer_travel_acceleration", + "initial_layer_acceleration", + "outer_wall_acceleration", + "inner_wall_acceleration", + "sparse_infill_acceleration", //coFloatsOrPercents + "internal_solid_infill_acceleration", //coFloatsOrPercents + "top_surface_acceleration", + "default_jerk", + "outer_wall_jerk", + "inner_wall_jerk", + "infill_jerk", + "top_surface_jerk", + "initial_layer_jerk", + "travel_jerk", + "initial_layer_travel_jerk", + "default_junction_deviation", "print_extruder_id", //coInts "print_extruder_variant" //coStrings }; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 880fd44389..33ad6f1cca 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -976,13 +976,13 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInt, support_interface_bottom_layers)) // Spacing between interface lines (the hatching distance). Set zero to get a solid interface. ((ConfigOptionFloat, support_interface_spacing)) - ((ConfigOptionFloat, support_interface_speed)) + ((ConfigOptionFloatsNullable, support_interface_speed)) ((ConfigOptionEnum, support_base_pattern)) ((ConfigOptionEnum, support_interface_pattern)) // Spacing between support material lines (the hatching distance). ((ConfigOptionFloat, support_base_pattern_spacing)) ((ConfigOptionFloat, support_expansion)) - ((ConfigOptionFloat, support_speed)) + ((ConfigOptionFloatsNullable, support_speed)) ((ConfigOptionEnum, support_style)) // Orca: a flag enabling the ability to override flow ratios @@ -1050,25 +1050,25 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, min_length_factor)) // Move all acceleration and jerk settings to object - ((ConfigOptionFloat, default_acceleration)) - ((ConfigOptionFloat, outer_wall_acceleration)) - ((ConfigOptionFloat, inner_wall_acceleration)) - ((ConfigOptionFloat, top_surface_acceleration)) - ((ConfigOptionFloat, initial_layer_acceleration)) - ((ConfigOptionFloatOrPercent, bridge_acceleration)) - ((ConfigOptionFloat, travel_acceleration)) - ((ConfigOptionFloatOrPercent, sparse_infill_acceleration)) - ((ConfigOptionFloatOrPercent, internal_solid_infill_acceleration)) + ((ConfigOptionFloatsNullable, default_acceleration)) + ((ConfigOptionFloatsNullable, outer_wall_acceleration)) + ((ConfigOptionFloatsNullable, inner_wall_acceleration)) + ((ConfigOptionFloatsNullable, top_surface_acceleration)) + ((ConfigOptionFloatsNullable, initial_layer_acceleration)) + ((ConfigOptionFloatsOrPercentsNullable, bridge_acceleration)) + ((ConfigOptionFloatsNullable, travel_acceleration)) + ((ConfigOptionFloatsOrPercentsNullable, sparse_infill_acceleration)) + ((ConfigOptionFloatsOrPercentsNullable, internal_solid_infill_acceleration)) - ((ConfigOptionFloat, default_jerk)) - ((ConfigOptionFloat, outer_wall_jerk)) - ((ConfigOptionFloat, inner_wall_jerk)) - ((ConfigOptionFloat, infill_jerk)) - ((ConfigOptionFloat, top_surface_jerk)) - ((ConfigOptionFloat, initial_layer_jerk)) - ((ConfigOptionFloat, travel_jerk)) + ((ConfigOptionFloatsNullable, default_jerk)) + ((ConfigOptionFloatsNullable, outer_wall_jerk)) + ((ConfigOptionFloatsNullable, inner_wall_jerk)) + ((ConfigOptionFloatsNullable, infill_jerk)) + ((ConfigOptionFloatsNullable, top_surface_jerk)) + ((ConfigOptionFloatsNullable, initial_layer_jerk)) + ((ConfigOptionFloatsNullable, travel_jerk)) ((ConfigOptionBool, precise_z_height)) - ((ConfigOptionFloat, default_junction_deviation)) + ((ConfigOptionFloatsNullable, default_junction_deviation)) ((ConfigOptionBool, interlocking_beam)) ((ConfigOptionFloat,interlocking_beam_width)) @@ -1093,8 +1093,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, internal_bridge_angle)) // ORCA: Internal bridge angle override ((ConfigOptionFloat, bridge_flow)) ((ConfigOptionFloat, internal_bridge_flow)) - ((ConfigOptionFloat, bridge_speed)) - ((ConfigOptionFloatOrPercent, internal_bridge_speed)) + ((ConfigOptionFloatsNullable, bridge_speed)) + ((ConfigOptionFloatsOrPercentsNullable, internal_bridge_speed)) ((ConfigOptionEnum, ensure_vertical_shell_thickness)) ((ConfigOptionPercent, top_surface_density)) ((ConfigOptionPercent, bottom_surface_density)) @@ -1102,7 +1102,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionEnum, bottom_surface_pattern)) ((ConfigOptionEnum, internal_solid_infill_pattern)) ((ConfigOptionFloatOrPercent, outer_wall_line_width)) - ((ConfigOptionFloat, outer_wall_speed)) + ((ConfigOptionFloatsNullable, outer_wall_speed)) ((ConfigOptionFloat, infill_direction)) ((ConfigOptionFloat, solid_infill_direction)) ((ConfigOptionString, solid_infill_rotate_template)) @@ -1128,12 +1128,12 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInt, fuzzy_skin_ripples_per_layer)) ((ConfigOptionPercent, fuzzy_skin_ripple_offset)) ((ConfigOptionInt, fuzzy_skin_layers_between_ripple_offset)) - ((ConfigOptionFloat, gap_infill_speed)) + ((ConfigOptionFloatsNullable, gap_infill_speed)) ((ConfigOptionInt, sparse_infill_filament)) ((ConfigOptionFloatOrPercent, sparse_infill_line_width)) ((ConfigOptionPercent, infill_wall_overlap)) ((ConfigOptionPercent, top_bottom_infill_wall_overlap)) - ((ConfigOptionFloat, sparse_infill_speed)) + ((ConfigOptionFloatsNullable, sparse_infill_speed)) ((ConfigOptionPercent, skeleton_infill_density)) ((ConfigOptionPercent, skin_infill_density)) ((ConfigOptionFloat, infill_lock_depth)) @@ -1171,19 +1171,19 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, minimum_sparse_infill_area)) ((ConfigOptionInt, solid_infill_filament)) ((ConfigOptionFloatOrPercent, internal_solid_infill_line_width)) - ((ConfigOptionFloat, internal_solid_infill_speed)) + ((ConfigOptionFloatsNullable, internal_solid_infill_speed)) // Detect thin walls. ((ConfigOptionBool, detect_thin_wall)) ((ConfigOptionFloatOrPercent, top_surface_line_width)) ((ConfigOptionInt, top_shell_layers)) ((ConfigOptionFloat, top_shell_thickness)) - ((ConfigOptionFloat, top_surface_speed)) + ((ConfigOptionFloatsNullable, top_surface_speed)) //BBS - ((ConfigOptionBool, enable_overhang_speed)) - ((ConfigOptionFloatOrPercent, overhang_1_4_speed)) - ((ConfigOptionFloatOrPercent, overhang_2_4_speed)) - ((ConfigOptionFloatOrPercent, overhang_3_4_speed)) - ((ConfigOptionFloatOrPercent, overhang_4_4_speed)) + ((ConfigOptionBoolsNullable, enable_overhang_speed)) + ((ConfigOptionFloatsOrPercentsNullable, overhang_1_4_speed)) + ((ConfigOptionFloatsOrPercentsNullable, overhang_2_4_speed)) + ((ConfigOptionFloatsOrPercentsNullable, overhang_3_4_speed)) + ((ConfigOptionFloatsOrPercentsNullable, overhang_4_4_speed)) ((ConfigOptionBool, only_one_wall_top)) //SoftFever @@ -1199,8 +1199,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, precise_outer_wall)) ((ConfigOptionPercent, bridge_density)) ((ConfigOptionFloat, filter_out_gap_fill)) - ((ConfigOptionFloatOrPercent, small_perimeter_speed)) - ((ConfigOptionFloat, small_perimeter_threshold)) + ((ConfigOptionFloatsOrPercentsNullable, small_perimeter_speed)) + ((ConfigOptionFloatsNullable, small_perimeter_threshold)) ((ConfigOptionFloat, top_solid_infill_flow_ratio)) ((ConfigOptionFloat, bottom_solid_infill_flow_ratio)) ((ConfigOptionFloatOrPercent, infill_anchor)) @@ -1209,7 +1209,7 @@ PRINT_CONFIG_CLASS_DEFINE( // Orca ((ConfigOptionBool, make_overhang_printable)) ((ConfigOptionBool, extra_perimeters_on_overhangs)) - ((ConfigOptionBool, slowdown_for_curled_perimeters)) + ((ConfigOptionBoolsNullable, slowdown_for_curled_perimeters)) ((ConfigOptionBool, hole_to_polyhole)) ((ConfigOptionFloatOrPercent, hole_to_polyhole_threshold)) ((ConfigOptionBool, hole_to_polyhole_twisted)) @@ -1372,7 +1372,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope)) ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_segment_length)) - ((ConfigOptionBool, extrusion_rate_smoothing_external_perimeter_only)) + ((ConfigOptionBool, extrusion_rate_smoothing_external_perimeter_only)) ((ConfigOptionPercents, retract_before_wipe)) @@ -1404,8 +1404,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionString, change_extrusion_role_gcode)) ((ConfigOptionString, process_change_extrusion_role_gcode)) ((ConfigOptionStrings, filament_change_extrusion_role_gcode)) - ((ConfigOptionFloat, travel_speed)) - ((ConfigOptionFloat, travel_speed_z)) + ((ConfigOptionFloatsNullable, travel_speed)) + ((ConfigOptionFloatsNullable, travel_speed_z)) ((ConfigOptionBool, silent_mode)) ((ConfigOptionString, machine_pause_gcode)) ((ConfigOptionString, template_custom_gcode)) @@ -1429,9 +1429,9 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, use_relative_e_distances)) ((ConfigOptionBool, accel_to_decel_enable)) ((ConfigOptionPercent, accel_to_decel_factor)) - ((ConfigOptionFloatOrPercent, initial_layer_travel_speed)) - ((ConfigOptionFloatOrPercent, initial_layer_travel_acceleration)) - ((ConfigOptionFloatOrPercent, initial_layer_travel_jerk)) + ((ConfigOptionFloatsOrPercentsNullable, initial_layer_travel_speed)) + ((ConfigOptionFloatsOrPercentsNullable, initial_layer_travel_acceleration)) + ((ConfigOptionFloatsOrPercentsNullable, initial_layer_travel_jerk)) ((ConfigOptionBool, bbl_calib_mark_logo)) ((ConfigOptionBool, disable_m73)) @@ -1537,10 +1537,10 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInts, complete_print_exhaust_fan_speed)) ((ConfigOptionFloatOrPercent, initial_layer_line_width)) ((ConfigOptionFloat, initial_layer_print_height)) - ((ConfigOptionFloat, initial_layer_speed)) + ((ConfigOptionFloatsNullable, initial_layer_speed)) //BBS - ((ConfigOptionFloat, initial_layer_infill_speed)) + ((ConfigOptionFloatsNullable, initial_layer_infill_speed)) ((ConfigOptionInts, nozzle_temperature_initial_layer)) ((ConfigOptionInts, full_fan_speed_layer)) ((ConfigOptionFloats, fan_max_speed)) diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 1df4dba9c2..85dac5aeb2 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -567,7 +567,7 @@ void ConfigManipulation::apply_null_fff_config(DynamicPrintConfig *config, std:: } } -void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, const bool is_global_config) +void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, int variant_index, const bool is_global_config) { PresetBundle *preset_bundle = wxGetApp().preset_bundle; @@ -669,7 +669,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co for (auto el : { "top_surface_line_width", "top_surface_speed" }) toggle_field(el, has_top_shell); - bool have_default_acceleration = config->opt_float("default_acceleration") > 0; + bool have_default_acceleration = config->opt_float_nullable("default_acceleration", variant_index) > 0; for (auto el : {"outer_wall_acceleration", "inner_wall_acceleration", "initial_layer_acceleration", "initial_layer_travel_acceleration", "top_surface_acceleration", "travel_acceleration", "bridge_acceleration", "sparse_infill_acceleration", "internal_solid_infill_acceleration"}) @@ -683,17 +683,17 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co } toggle_line("default_junction_deviation", gcflavor == gcfMarlinFirmware); if (machine_supports_junction_deviation) { - toggle_field("default_junction_deviation", true); - toggle_field("default_jerk", false); + toggle_field("default_junction_deviation", true, variant_index); + toggle_field("default_jerk", false, variant_index); for (auto el : { "outer_wall_jerk", "inner_wall_jerk", "initial_layer_jerk", "initial_layer_travel_jerk", "top_surface_jerk", "travel_jerk", "infill_jerk"}) - toggle_line(el, false); + toggle_line(el, false, variant_index); } else { toggle_field("default_junction_deviation", false); toggle_field("default_jerk", true); - bool have_default_jerk = config->has("default_jerk") && config->opt_float("default_jerk") > 0; + bool have_default_jerk = config->has("default_jerk") && config->opt_float_nullable("default_jerk", variant_index) > 0; for (auto el : { "outer_wall_jerk", "inner_wall_jerk", "initial_layer_jerk", "initial_layer_travel_jerk", "top_surface_jerk", "travel_jerk", "infill_jerk"}) { - toggle_line(el, true); - toggle_field(el, have_default_jerk); + toggle_line(el, true, variant_index); + toggle_field(el, have_default_jerk, variant_index); } } @@ -869,11 +869,11 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co for (auto el : {"first_layer_flow_ratio", "outer_wall_flow_ratio", "inner_wall_flow_ratio", "overhang_flow_ratio", "sparse_infill_flow_ratio", "internal_solid_infill_flow_ratio", "gap_fill_flow_ratio", "support_flow_ratio", "support_interface_flow_ratio"}) toggle_line(el, has_set_other_flow_ratios); - bool has_overhang_speed = config->opt_bool("enable_overhang_speed"); + 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); + toggle_line(el, has_overhang_speed, variant_index); - toggle_line("slowdown_for_curled_perimeters", has_overhang_speed); + toggle_line("slowdown_for_curled_perimeters", has_overhang_speed, variant_index); toggle_line("flush_into_objects", !is_global_config); diff --git a/src/slic3r/GUI/ConfigManipulation.hpp b/src/slic3r/GUI/ConfigManipulation.hpp index 59d7779d33..a374a4887a 100644 --- a/src/slic3r/GUI/ConfigManipulation.hpp +++ b/src/slic3r/GUI/ConfigManipulation.hpp @@ -70,7 +70,7 @@ public: // FFF print void update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config = false, const bool is_plate_config = false); - void toggle_print_fff_options(DynamicPrintConfig* config, const bool is_global_config = false); + void toggle_print_fff_options(DynamicPrintConfig* config, int variant_index, const bool is_global_config = false); void apply_null_fff_config(DynamicPrintConfig *config, std::vector const &keys, std::map const & configs); //BBS: FFF filament nozzle temperature range diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index 9073a19df2..65cd99a2fa 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -406,7 +406,7 @@ void ObjectSettings::update_config_values(ModelConfig* config) printer_technology == ptFFF ? config_manipulation.update_print_fff_config(&main_config) : config_manipulation.update_print_sla_config(&main_config) ; - printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&main_config) : + printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&main_config, 0) : config_manipulation.toggle_print_sla_options(&main_config) ; } diff --git a/src/slic3r/GUI/GUI_ObjectTableSettings.cpp b/src/slic3r/GUI/GUI_ObjectTableSettings.cpp index 11cd00cdc8..37ccfb8e41 100644 --- a/src/slic3r/GUI/GUI_ObjectTableSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectTableSettings.cpp @@ -300,7 +300,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_ bool is_BBL_printer = wxGetApp().preset_bundle->is_bbl_vendor(); config_manipulation.set_is_BBL_Printer(is_BBL_printer); - printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&m_current_config) : + printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&m_current_config, 0) : config_manipulation.toggle_print_sla_options(&m_current_config) ; optgroup->update_visibility(wxGetApp().get_mode()); } @@ -406,7 +406,7 @@ void ObjectTableSettings::update_config_values(bool is_object, ModelObject* obje printer_technology == ptFFF ? config_manipulation.update_print_fff_config(&main_config) : config_manipulation.update_print_sla_config(&main_config) ; - printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&main_config) : + printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&main_config, 0) : config_manipulation.toggle_print_sla_options(&main_config) ; for (auto og : m_og_settings) { og->update_visibility(wxGetApp().get_mode()); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 534646d593..87e5a5c3e9 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -59,6 +59,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co default: switch (opt.type) { case coFloatOrPercent: + case coFloatsOrPercents: case coFloat: case coFloats: case coPercent: diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index aeddd53f8a..5f591131ee 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -511,8 +511,6 @@ void Tab::create_preset_tab() m_actual_nozzle_volumes[extruder_id] = nozzle_type; switch_excluder(extruder_id); - reload_config(); - update_changed_ui(); }); m_extruder_sync_box = new wxPanel(panel, wxID_ANY); m_extruder_sync_box->SetBackgroundColour(panel->GetBackgroundColour()); @@ -2166,15 +2164,12 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) int extruder_idx = std::atoi(opt_key.substr(opt_key.find_last_of('#') + 1).c_str()); for (auto tab : wxGetApp().tabs_list) { tab->update_extruder_variants(extruder_idx); - tab->reload_config(); } if (auto tab = wxGetApp().plate_tab) { tab->update_extruder_variants(extruder_idx); - tab->reload_config(); } for (auto tab : wxGetApp().model_tabs_list) { tab->update_extruder_variants(extruder_idx); - tab->reload_config(); } if (wxGetApp().app_config->get("auto_calculate_flush") == "all") { wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(-1,extruder_idx); @@ -2756,66 +2751,66 @@ void TabPrint::build() page = add_options_page(L("Speed"), "custom-gcode_speed"); // ORCA: icon only visible on placeholders optgroup = page->new_optgroup(L("First layer speed"), L"param_speed_first", 15); - optgroup->append_single_option_line("initial_layer_speed", "speed_settings_initial_layer_speed#initial-layer"); - optgroup->append_single_option_line("initial_layer_infill_speed", "speed_settings_initial_layer_speed#initial-layer-infill"); - optgroup->append_single_option_line("initial_layer_travel_speed", "speed_settings_initial_layer_speed#initial-layer-travel-speed"); + optgroup->append_single_option_line("initial_layer_speed", "speed_settings_initial_layer_speed#initial-layer", 0); + optgroup->append_single_option_line("initial_layer_infill_speed", "speed_settings_initial_layer_speed#initial-layer-infill", 0); + optgroup->append_single_option_line("initial_layer_travel_speed", "speed_settings_initial_layer_speed#initial-layer-travel-speed", 0); optgroup->append_single_option_line("slow_down_layers", "speed_settings_initial_layer_speed#number-of-slow-layers"); optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15); - optgroup->append_single_option_line("outer_wall_speed", "speed_settings_other_layers_speed#outer-wall"); + optgroup->append_single_option_line("outer_wall_speed", "speed_settings_other_layers_speed#outer-wall", 0); optgroup->append_single_option_line("inner_wall_speed", "speed_settings_other_layers_speed#inner-wall", 0); - optgroup->append_single_option_line("small_perimeter_speed", "speed_settings_other_layers_speed#small-perimeters"); - optgroup->append_single_option_line("small_perimeter_threshold", "speed_settings_other_layers_speed#small-perimeters-threshold"); - optgroup->append_single_option_line("sparse_infill_speed", "speed_settings_other_layers_speed#sparse-infill"); - optgroup->append_single_option_line("internal_solid_infill_speed", "speed_settings_other_layers_speed#internal-solid-infill"); - optgroup->append_single_option_line("top_surface_speed", "speed_settings_other_layers_speed#top-surface"); - optgroup->append_single_option_line("gap_infill_speed", "speed_settings_other_layers_speed#gap-infill"); + optgroup->append_single_option_line("small_perimeter_speed", "speed_settings_other_layers_speed#small-perimeters", 0); + optgroup->append_single_option_line("small_perimeter_threshold", "speed_settings_other_layers_speed#small-perimeters-threshold", 0); + optgroup->append_single_option_line("sparse_infill_speed", "speed_settings_other_layers_speed#sparse-infill", 0); + optgroup->append_single_option_line("internal_solid_infill_speed", "speed_settings_other_layers_speed#internal-solid-infill", 0); + optgroup->append_single_option_line("top_surface_speed", "speed_settings_other_layers_speed#top-surface", 0); + optgroup->append_single_option_line("gap_infill_speed", "speed_settings_other_layers_speed#gap-infill", 0); optgroup->append_single_option_line("ironing_speed", "speed_settings_other_layers_speed#ironing-speed"); - optgroup->append_single_option_line("support_speed", "speed_settings_other_layers_speed#support"); - optgroup->append_single_option_line("support_interface_speed", "speed_settings_other_layers_speed#support-interface"); + optgroup->append_single_option_line("support_speed", "speed_settings_other_layers_speed#support", 0); + optgroup->append_single_option_line("support_interface_speed", "speed_settings_other_layers_speed#support-interface", 0); optgroup = page->new_optgroup(L("Overhang speed"), L"param_overhang_speed", 15); - optgroup->append_single_option_line("enable_overhang_speed", "speed_settings_overhang_speed#slow-down-for-overhang"); + optgroup->append_single_option_line("enable_overhang_speed", "speed_settings_overhang_speed#slow-down-for-overhang", 0); - optgroup->append_single_option_line("slowdown_for_curled_perimeters", "speed_settings_overhang_speed#slow-down-for-curled-perimeters"); + optgroup->append_single_option_line("slowdown_for_curled_perimeters", "speed_settings_overhang_speed#slow-down-for-curled-perimeters", 0); Line line = { L("Overhang speed"), L("This is the speed for various overhang degrees. Overhang degrees are expressed as a percentage of line width. 0 speed means no slowing down for the overhang degree range and wall speed is used") }; line.label_path = "speed_settings_overhang_speed#speed"; - line.append_option(optgroup->get_option("overhang_1_4_speed")); - line.append_option(optgroup->get_option("overhang_2_4_speed")); - line.append_option(optgroup->get_option("overhang_3_4_speed")); - line.append_option(optgroup->get_option("overhang_4_4_speed")); + line.append_option(optgroup->get_option("overhang_1_4_speed", 0)); + line.append_option(optgroup->get_option("overhang_2_4_speed", 0)); + line.append_option(optgroup->get_option("overhang_3_4_speed", 0)); + line.append_option(optgroup->get_option("overhang_4_4_speed", 0)); optgroup->append_line(line); optgroup->append_separator(); line = { L("Bridge"), L("Set speed for external and internal bridges") }; - line.append_option(optgroup->get_option("bridge_speed")); - line.append_option(optgroup->get_option("internal_bridge_speed")); + line.append_option(optgroup->get_option("bridge_speed", 0)); + line.append_option(optgroup->get_option("internal_bridge_speed", 0)); optgroup->append_line(line); optgroup = page->new_optgroup(L("Travel speed"), L"param_travel_speed", 15); - optgroup->append_single_option_line("travel_speed", "speed_settings_travel"); + optgroup->append_single_option_line("travel_speed", "speed_settings_travel", 0); optgroup = page->new_optgroup(L("Acceleration"), L"param_acceleration", 15); - optgroup->append_single_option_line("default_acceleration", "speed_settings_acceleration#normal-printing"); - optgroup->append_single_option_line("outer_wall_acceleration", "speed_settings_acceleration#outer-wall"); - optgroup->append_single_option_line("inner_wall_acceleration", "speed_settings_acceleration#inner-wall"); - optgroup->append_single_option_line("bridge_acceleration", "speed_settings_acceleration#bridge"); - optgroup->append_single_option_line("sparse_infill_acceleration", "speed_settings_acceleration#sparse-infill"); - optgroup->append_single_option_line("internal_solid_infill_acceleration", "speed_settings_acceleration#internal-solid-infill"); - optgroup->append_single_option_line("initial_layer_acceleration", "speed_settings_acceleration#initial-layer"); - optgroup->append_single_option_line("initial_layer_travel_acceleration", "speed_settings_acceleration#initial-layer-travel"); - optgroup->append_single_option_line("top_surface_acceleration", "speed_settings_acceleration#top-surface"); - optgroup->append_single_option_line("travel_acceleration", "speed_settings_acceleration#travel"); + optgroup->append_single_option_line("default_acceleration", "speed_settings_acceleration#normal-printing", 0); + optgroup->append_single_option_line("outer_wall_acceleration", "speed_settings_acceleration#outer-wall", 0); + optgroup->append_single_option_line("inner_wall_acceleration", "speed_settings_acceleration#inner-wall", 0); + optgroup->append_single_option_line("bridge_acceleration", "speed_settings_acceleration#bridge", 0); + optgroup->append_single_option_line("sparse_infill_acceleration", "speed_settings_acceleration#sparse-infill", 0); + optgroup->append_single_option_line("internal_solid_infill_acceleration", "speed_settings_acceleration#internal-solid-infill", 0); + optgroup->append_single_option_line("initial_layer_acceleration", "speed_settings_acceleration#initial-layer", 0); + optgroup->append_single_option_line("initial_layer_travel_acceleration", "speed_settings_acceleration#initial-layer-travel", 0); + optgroup->append_single_option_line("top_surface_acceleration", "speed_settings_acceleration#top-surface", 0); + optgroup->append_single_option_line("travel_acceleration", "speed_settings_acceleration#travel", 0); optgroup->append_single_option_line("accel_to_decel_enable", "speed_settings_acceleration"); optgroup->append_single_option_line("accel_to_decel_factor", "speed_settings_acceleration"); optgroup = page->new_optgroup(L("Jerk(XY)"), L"param_jerk", 15); - optgroup->append_single_option_line("default_junction_deviation", "speed_settings_jerk_xy#junction-deviation"); - optgroup->append_single_option_line("default_jerk", "speed_settings_jerk_xy#default"); - optgroup->append_single_option_line("outer_wall_jerk", "speed_settings_jerk_xy#outer-wall"); - optgroup->append_single_option_line("inner_wall_jerk", "speed_settings_jerk_xy#inner-wall"); - optgroup->append_single_option_line("infill_jerk", "speed_settings_jerk_xy#infill"); - optgroup->append_single_option_line("top_surface_jerk", "speed_settings_jerk_xy#top-surface"); - optgroup->append_single_option_line("initial_layer_jerk", "speed_settings_jerk_xy#initial-layer"); - optgroup->append_single_option_line("initial_layer_travel_jerk", "speed_settings_jerk_xy#initial-layer-travel"); - optgroup->append_single_option_line("travel_jerk", "speed_settings_jerk_xy#travel"); + optgroup->append_single_option_line("default_junction_deviation", "speed_settings_jerk_xy#junction-deviation", 0); + optgroup->append_single_option_line("default_jerk", "speed_settings_jerk_xy#default", 0); + optgroup->append_single_option_line("outer_wall_jerk", "speed_settings_jerk_xy#outer-wall", 0); + optgroup->append_single_option_line("inner_wall_jerk", "speed_settings_jerk_xy#inner-wall", 0); + optgroup->append_single_option_line("infill_jerk", "speed_settings_jerk_xy#infill", 0); + optgroup->append_single_option_line("top_surface_jerk", "speed_settings_jerk_xy#top-surface", 0); + optgroup->append_single_option_line("initial_layer_jerk", "speed_settings_jerk_xy#initial-layer", 0); + optgroup->append_single_option_line("initial_layer_travel_jerk", "speed_settings_jerk_xy#initial-layer-travel", 0); + optgroup->append_single_option_line("travel_jerk", "speed_settings_jerk_xy#travel", 0); optgroup = page->new_optgroup(L("Advanced"), L"param_advanced", 15); optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope", "speed_settings_advanced"); @@ -3075,7 +3070,7 @@ void TabPrint::toggle_options() m_config_manipulation.set_is_BBL_Printer(is_BBL_printer); } - m_config_manipulation.toggle_print_fff_options(m_config, m_type < Preset::TYPE_COUNT); + m_config_manipulation.toggle_print_fff_options(m_config, int(intptr_t(m_extruder_switch->GetClientData())), m_type < Preset::TYPE_COUNT); Field *field = m_active_page->get_field("support_style"); auto support_type = m_config->opt_enum("support_type"); @@ -4653,6 +4648,40 @@ wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticTex return sizer; } +void Tab::update_pages_with_multi_variant() +{ + if (!m_active_page) { + return; + } + // TODO: Orca: support multi variant field + //for (auto optgroup : m_active_page->m_optgroups) { + // Field *multi_variant_field = nullptr; + // std::string opt_key; + + // for (const auto& opt : multi_variant_text_ctrl_options) { + // Field* field = optgroup->get_fieldc(opt, 0); + // if (field) { + // auto *multi_variant = dynamic_cast(field); + // if (multi_variant) {; + // multi_variant_field = field; + // opt_key = opt; + // } + // break; + // } + // } + // if (multi_variant_field) { + // auto * multi_variant_ctrl = dynamic_cast(multi_variant_field); + // multi_variant_ctrl->refresh_text_ctrls_layout(optgroup->ctrl_parent()); + // if (optgroup->custom_ctrl) { + // optgroup->custom_ctrl->update_line_height_for_field(opt_key); + // } + // } + // m_page_view->GetParent()->Layout(); + // m_parent->Layout(); + //} + update_changed_ui(); +} + bool Tab::saved_preset_is_dirty() const { return m_presets->saved_is_dirty(); } void Tab::update_saved_preset_from_current_preset() { m_presets->update_saved_preset_from_current_preset(); } bool Tab::current_preset_is_dirty() const { return m_presets->current_is_dirty(); } @@ -5927,7 +5956,6 @@ void Tab::load_current_preset() update_btns_enabling(); - update(); if (m_type == Slic3r::Preset::TYPE_PRINTER) { // For the printer profile, generate the extruder pages. if (preset.printer_technology() == ptFFF) { @@ -5938,21 +5966,20 @@ void Tab::load_current_preset() else wxGetApp().obj_list()->update_objects_list_filament_column(1); } - - // Reload preset pages with the new configuration values. - update_extruder_variants(); if (m_type == Preset::TYPE_PRINT) { if (auto tab = wxGetApp().plate_tab) { tab->m_config->apply(*m_config); tab->update_extruder_variants(); - tab->reload_config(); } for (auto tab : wxGetApp().model_tabs_list) { tab->m_config->apply(*m_config); tab->update_extruder_variants(); - tab->reload_config(); } } + update(); + + // Reload preset pages with the new configuration values. + update_extruder_variants(-1, false); reload_config(); update_ui_items_related_on_parent_preset(m_presets->get_selected_preset_parent()); @@ -7559,7 +7586,7 @@ void Tab::set_just_edit(bool just_edit) /// /// -void Tab::update_extruder_variants(int extruder_id) +void Tab::update_extruder_variants(int extruder_id, bool reload) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << extruder_id; if (m_extruder_switch) { @@ -7601,7 +7628,10 @@ void Tab::update_extruder_variants(int extruder_id) m_variant_combo->Enable(options.size() > 1); } - switch_excluder(extruder_id); + switch_excluder(extruder_id, reload); + if (m_type == Preset::TYPE_PRINT) { + update_pages_with_multi_variant(); + } if (m_variant_sizer) { wxWindow *variant_ctrl = m_extruder_switch ? (wxWindow *) m_extruder_switch : m_variant_combo; m_main_sizer->Show(m_variant_sizer, variant_ctrl->IsThisEnabled() && m_active_page && !m_active_page->m_opt_id_map.empty() && !m_active_page->title().StartsWith("Extruder ")); @@ -7756,7 +7786,7 @@ bool Tab::get_extruder_sync_enable_state(int extruder_id) return false; } -void Tab::switch_excluder(int extruder_id) +void Tab::switch_excluder(int extruder_id, bool reload) { Preset & printer_preset = m_preset_bundle->printers.get_edited_preset(); auto nozzle_volumes = m_preset_bundle->project_config.option("nozzle_volume_type"); @@ -7826,6 +7856,14 @@ void Tab::switch_excluder(int extruder_id) } } } + if (reload) { + reload_config(); + update_changed_ui(); + toggle_options(); + if (m_active_page) + m_active_page->update_visibility(m_mode, true); + m_page_view->GetParent()->Layout(); + } } void Tab::sync_excluder() diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index b5ce4775a5..7c9c180f07 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -405,6 +405,7 @@ public: bool current_preset_is_dirty() const; bool saved_preset_is_dirty() const; void update_saved_preset_from_current_preset(); + void update_pages_with_multi_variant(); DynamicPrintConfig* get_config() { return m_config; } PresetCollection * get_presets() { return m_presets; } @@ -437,8 +438,8 @@ public: virtual const std::string& get_custom_gcode(const t_config_option_key& opt_key); virtual void set_custom_gcode(const t_config_option_key& opt_key, const std::string& value); - void update_extruder_variants(int extruder_id = -1); - void switch_excluder(int extruder_id = -1); + void update_extruder_variants(int extruder_id = -1, bool reload = true); + void switch_excluder(int extruder_id = -1, bool reload = true); void sync_excluder(); void parse_extruder_selection(int selection, int &extruder_id, NozzleVolumeType &nozzle_type); int calculate_selection_index_for_extruder(int extruder_id, NozzleVolumeType nozzle_type);