ENH: remove nozzle_hrc in params page and profiles

use std::map to map nozzle_type to nozzle_hrc

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ie9d1db486808bd5164c7952caecaf4ac279f43d8
This commit is contained in:
xun.zhang 2023-07-26 15:52:03 +08:00 committed by Lane.Wei
parent 0c45cac1a8
commit 793c657b46
18 changed files with 19 additions and 33 deletions

File diff suppressed because one or more lines are too long

View file

@ -21,7 +21,6 @@
"min_layer_height": [
"0.12"
],
"nozzle_hrc": "55",
"nozzle_type": "hardened_steel",
"retraction_length": [
"1.4"

View file

@ -21,7 +21,6 @@
"min_layer_height": [
"0.16"
],
"nozzle_hrc": "55",
"nozzle_type": "hardened_steel",
"retract_length_toolchange": [
"3"

View file

@ -28,7 +28,6 @@
"machine_load_filament_time": "29",
"machine_unload_filament_time": "28",
"nozzle_type": "stainless_steel",
"nozzle_hrc": "20",
"auxiliary_fan": "1",
"upward_compatible_machine":[
"Bambu Lab P1P 0.4 nozzle",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,6 @@
"min_layer_height": [
"0.12"
],
"nozzle_hrc": "55",
"nozzle_type": "hardened_steel",
"retraction_length": [
"1.4"

View file

@ -18,7 +18,6 @@
"min_layer_height": [
"0.16"
],
"nozzle_hrc": "55",
"nozzle_type": "hardened_steel",
"retract_length_toolchange": [
"3"

View file

@ -21,7 +21,6 @@
"min_layer_height": [
"0.04"
],
"nozzle_hrc": "20",
"nozzle_type": "stainless_steel",
"retraction_length": [
"0.4"

File diff suppressed because one or more lines are too long

View file

@ -63,6 +63,13 @@ const std::vector<std::string> GCodeProcessor::Reserved_Tags = {
const std::string GCodeProcessor::Flush_Start_Tag = " FLUSH_START";
const std::string GCodeProcessor::Flush_End_Tag = " FLUSH_END";
const std::map<NozzleType,int> GCodeProcessor::Nozzle_Type_To_HRC={
{NozzleType::ntStainlessSteel,20},
{NozzleType::ntHardenedSteel,55},
{NozzleType::ntBrass,2},
{NozzleType::ntUndefine,0}
};
const float GCodeProcessor::Wipe_Width = 0.05f;
const float GCodeProcessor::Wipe_Height = 0.05f;
@ -910,8 +917,7 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_result.filament_densities.resize(extruders_count);
m_result.filament_vitrification_temperature.resize(extruders_count);
m_extruder_temps.resize(extruders_count);
m_result.nozzle_hrc = static_cast<int>(config.nozzle_hrc.getInt());
m_result.nozzle_type = config.nozzle_type;
for (size_t i = 0; i < extruders_count; ++ i) {
m_extruder_offsets[i] = to_3d(config.extruder_offset.get_at(i).cast<float>().eval(), 0.f);
m_extruder_colors[i] = static_cast<unsigned char>(i);
@ -967,8 +973,9 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
if (nozzle_volume != nullptr)
m_nozzle_volume = nozzle_volume->value;
const ConfigOptionInt *nozzle_HRC = config.option<ConfigOptionInt>("nozzle_hrc");
if (nozzle_HRC != nullptr) m_result.nozzle_hrc = nozzle_HRC->value;
const ConfigOptionEnum<NozzleType>* nozzle_type = config.option<ConfigOptionEnum<NozzleType>>("nozzle_type");
if (nozzle_type != nullptr)
m_result.nozzle_type=nozzle_type->value;
const ConfigOptionEnum<GCodeFlavor>* gcode_flavor = config.option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor");
if (gcode_flavor != nullptr)
@ -4281,12 +4288,14 @@ void GCodeProcessor::update_slice_warnings()
//bbs:HRC checker
warning.params.clear();
warning.level=1;
if (m_result.nozzle_hrc!=0) {
int nozzle_hrc = Nozzle_Type_To_HRC.find(m_result.nozzle_type)->second;
if (nozzle_hrc!=0) {
for (size_t i = 0; i < used_extruders.size(); i++) {
int HRC=0;
if (used_extruders[i] < m_result.required_nozzle_HRC.size())
HRC = m_result.required_nozzle_HRC[used_extruders[i]];
if (HRC != 0 && (m_result.nozzle_hrc<HRC))
if (HRC != 0 && (nozzle_hrc<HRC))
warning.params.push_back(std::to_string(used_extruders[i]));
}
}

View file

@ -192,7 +192,7 @@ namespace Slic3r {
std::vector<std::pair<float, std::pair<size_t, size_t>>> spiral_vase_layers;
//BBS
std::vector<SliceWarning> warnings;
int nozzle_hrc;
NozzleType nozzle_type;
BedType bed_type = BedType::btCount;
#if ENABLE_GCODE_VIEWER_STATISTICS
int64_t time{ 0 };
@ -237,7 +237,7 @@ namespace Slic3r {
static const std::vector<std::string> Reserved_Tags;
static const std::string Flush_Start_Tag;
static const std::string Flush_End_Tag;
static const std::map<NozzleType, int>Nozzle_Type_To_HRC;
public:
enum class ETags : unsigned char
{

View file

@ -831,7 +831,7 @@ static std::vector<std::string> s_Preset_printer_options {
"silent_mode",
// BBS
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
"nozzle_type", "nozzle_hrc","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types",
"nozzle_type","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types",
//OrcaSlicer
"host_type", "print_host", "printhost_apikey",
"print_host_webui",

View file

@ -146,7 +146,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"curr_bed_type",
"nozzle_volume",
"chamber_temperature",
"nozzle_hrc",
"required_nozzle_HRC",
"upward_compatible_machine",
//OrcaSlicer

View file

@ -1675,15 +1675,6 @@ void PrintConfigDef::init_fff_params()
def->mode = comDevelop;
def->set_default_value(new ConfigOptionEnum<NozzleType>(ntUndefine));
def = this->add("nozzle_hrc", coInt);
def->label = L("Nozzle HRC");
def->tooltip = L("The nozzle's hardness. Zero means no checking for nozzle's hardness during slicing.");
def->sidetext = L("HRC");
def->min = 0;
def->max = 500;
def->mode = comDevelop;
def->set_default_value(new ConfigOptionInt{0});
def = this->add("auxiliary_fan", coBool);
def->label = L("Auxiliary part cooling fan");
def->tooltip = L("Enable this option if machine has auxiliary part cooling fan");
@ -4247,7 +4238,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
"remove_freq_sweep", "remove_bed_leveling", "remove_extrusion_calibration",
"support_transition_line_width", "support_transition_speed", "bed_temperature", "bed_temperature_initial_layer",
"can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height",
"z_hop_type"
"z_hop_type","nozzle_hrc"
};
if (ignore.find(opt_key) != ignore.end()) {

View file

@ -866,7 +866,6 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionString, template_custom_gcode))
//BBS
((ConfigOptionEnum<NozzleType>, nozzle_type))
((ConfigOptionInt, nozzle_hrc))
((ConfigOptionBool, auxiliary_fan))
((ConfigOptionBool, accel_to_decel_enable))
((ConfigOptionPercent, accel_to_decel_factor))

View file

@ -3080,7 +3080,6 @@ void TabPrinter::build_fff()
optgroup = page->new_optgroup(L("Accessory") /*, L"param_accessory"*/);
optgroup->append_single_option_line("nozzle_type");
optgroup->append_single_option_line("nozzle_hrc");
optgroup->append_single_option_line("auxiliary_fan");
const int gcode_field_height = 15; // 150