mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 19:02:10 +00:00
Add nozzle flow variant & make some options multi-variant (#13712)
# Description Port BBS per-extruder config variants toggle, thanks Bambu! Also fix invalid num error when resetting multi-variant filament overrides. TODOs: - [x] Make more configs multi-variant (such as speeds) - [x] Add flow variant (normal/high flow) combo box - [x] Add botton to sync config to other variant # Screenshots/Recordings/Graphs <img width="846" height="1494" alt="image" src="https://github.com/user-attachments/assets/47abf053-f5b8-4c86-ac0b-c0323ed8b242" /> <img width="1478" height="1189" alt="707420e5be01c30af3e6ede1f3dc9b67" src="https://github.com/user-attachments/assets/11268712-da65-42ab-9cb8-3cede7790a5c" /> <img width="1478" height="1189" alt="81d5d3877f4d5bf9dccd44d7f0b30aa7" src="https://github.com/user-attachments/assets/cda5ea51-07c3-48fc-bfbb-1428dca14e26" /> ## Tests <!-- > Please describe the tests that you have conducted to verify the changes made in this PR. --> <!-- > A guide for users on how to download the artifacts from this PR. --> [How to Download Pull Requests Artifacts for Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts) Fix #10336
This commit is contained in:
@@ -239,6 +239,32 @@ static string get_diameter_string(float diameter)
|
||||
return s;
|
||||
}
|
||||
|
||||
template <typename T, typename OptionType>
|
||||
static void set_config_values(DynamicPrintConfig *config, const std::string &key, T value)
|
||||
{
|
||||
auto config_opt = config->option<OptionType>(key);
|
||||
if (config_opt) {
|
||||
for (size_t i = 0; i < config_opt->values.size(); ++i) {
|
||||
config_opt->values[i] = value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(info) << "set_config_values: the key" << key << "is empty.";
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename OptionType>
|
||||
static void set_config_values(ModelConfig& config, const std::string &key, T value)
|
||||
{
|
||||
auto config_opt = config.get().option<OptionType>(key);
|
||||
if (config_opt) {
|
||||
config.set_key_value(key, new OptionType(config_opt->values.size(), value));
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(info) << "set_config_values: the key" << key << "is empty.";
|
||||
}
|
||||
}
|
||||
|
||||
bool Plater::has_illegal_filename_characters(const wxString& wxs_name)
|
||||
{
|
||||
std::string name = into_u8(wxs_name);
|
||||
@@ -640,7 +666,7 @@ void Sidebar::priv::layout_printer(bool isBBL, bool isDual)
|
||||
|
||||
// ORCA show plate type combo box only when its supported
|
||||
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
|
||||
auto cfg = preset_bundle.printers.get_edited_preset().config;
|
||||
const auto& cfg = preset_bundle.printers.get_edited_preset().config;
|
||||
// Orca: we use preset_bundle.is_bbl_vendor() instead of isBBL to determine if the plate type combo box should be shown
|
||||
// ref: https://github.com/OrcaSlicer/OrcaSlicer/pull/11610#discussion_r2607411847
|
||||
panel_printer_bed->Show(preset_bundle.is_bbl_vendor() || cfg.opt_bool("support_multi_bed_types"));
|
||||
@@ -649,8 +675,17 @@ void Sidebar::priv::layout_printer(bool isBBL, bool isDual)
|
||||
|
||||
// NEEDFIX requires AMS check or any type of ???
|
||||
// Single nozzle & non ams
|
||||
panel_nozzle_dia->Show(!isDual && preset_bundle.get_printer_extruder_count() < 2);
|
||||
extruder_single_sizer->Show(false);
|
||||
if (!isDual) {
|
||||
// Orca: for printer without flow variant, we do not show flow combo
|
||||
int extruder_count = 0;
|
||||
const bool has_flow_variant = cfg.support_different_extruders(extruder_count);
|
||||
|
||||
panel_nozzle_dia->Show(!has_flow_variant);
|
||||
extruder_single_sizer->Show(has_flow_variant);
|
||||
} else {
|
||||
panel_nozzle_dia->Show(false);
|
||||
extruder_single_sizer->Show(false);
|
||||
}
|
||||
|
||||
// ORCA ensure printer section is visible after changing printer from printer selection dialog
|
||||
// this will inform user on printer change when printer section is collapsed
|
||||
@@ -1119,21 +1154,19 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
|
||||
wxBoxSizer * hsizer_nozzle = new wxBoxSizer(wxHORIZONTAL);
|
||||
hsizer_nozzle->Add(label_flow, 0, wxALIGN_CENTER);
|
||||
hsizer_nozzle->Add(combo_flow, 1, wxEXPAND);
|
||||
label_flow->Hide(); // TODO: Orca hack, hide flow selection
|
||||
combo_flow->Hide();
|
||||
if (index < 0) {
|
||||
label_ams->Hide();
|
||||
ams_not_installed_msg->Hide();
|
||||
wxStaticBoxSizer *hsizer = new wxStaticBoxSizer(this, wxHORIZONTAL);
|
||||
hsizer->Add(hsizer_diameter, 1, wxEXPAND | wxTOP| wxBOTTOM, FromDIP(8));
|
||||
//hsizer->Add(hsizer_nozzle, 1, wxEXPAND | wxALL, FromDIP(8));
|
||||
hsizer->Add(hsizer_nozzle, 1, wxEXPAND | wxALL, FromDIP(8));
|
||||
hsizer->AddSpacer(FromDIP(2)); // Avoid badge
|
||||
this->sizer = hsizer;
|
||||
} else {
|
||||
wxStaticBoxSizer *vsizer = new wxStaticBoxSizer(this, wxVERTICAL);
|
||||
vsizer->Add(hsizer_ams, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(2));
|
||||
vsizer->Add(hsizer_diameter, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT | wxBOTTOM, FromDIP(2));
|
||||
//vsizer->Add(hsizer_nozzle, 0, wxEXPAND | wxALL, FromDIP(2));
|
||||
vsizer->Add(hsizer_nozzle, 0, wxEXPAND | wxALL, FromDIP(2));
|
||||
this->sizer = vsizer;
|
||||
}
|
||||
AMSCountPopupWindow::UpdateAMSCount(index < 0 ? 0 : index, this);
|
||||
@@ -1294,6 +1327,14 @@ bool Sidebar::priv::switch_diameter(bool single)
|
||||
return wxGetApp().get_tab(Preset::TYPE_PRINTER)->select_preset(preset->name);
|
||||
}
|
||||
|
||||
static bool is_skip_high_flow_printer(const std::string& printer)
|
||||
{
|
||||
static const std::set<std::string> invalidate_list = {
|
||||
"Bambu Lab X1E"
|
||||
};
|
||||
return invalidate_list.count(printer);
|
||||
};
|
||||
|
||||
bool Sidebar::priv::sync_extruder_list(bool &only_external_material)
|
||||
{
|
||||
MachineObject *obj = wxGetApp().getDeviceManager()->get_selected_machine();
|
||||
@@ -2633,8 +2674,6 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
|
||||
Preset& printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
|
||||
|
||||
bool isBBL = preset_bundle.is_bbl_vendor();
|
||||
|
||||
if (auto printer_structure_opt = printer_preset.config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure")) {
|
||||
wxGetApp().plater()->get_current_canvas3D()->get_arrange_settings().align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
||||
}
|
||||
@@ -2643,11 +2682,50 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
|
||||
// Update dual extrudes
|
||||
auto* nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(printer_preset.config.option("nozzle_diameter"));
|
||||
auto extruder_variants = printer_preset.config.option<ConfigOptionStrings>("extruder_variant_list");
|
||||
std::string printer_model = printer_preset.config.option<ConfigOptionString>("printer_model")->value;
|
||||
|
||||
bool is_dual_extruder = nozzle_diameter->size() == 2;
|
||||
bool isBBL = preset_bundle.is_bbl_vendor();
|
||||
bool is_dual_extruder = extruder_variants->size() == 2;
|
||||
p->layout_printer(preset_bundle.use_bbl_network(), isBBL && is_dual_extruder);
|
||||
|
||||
// Update nozzle titles from printer config (e.g. "Main Nozzle" / "Auxiliary Nozzle" for N6)
|
||||
// UI left = DEPUTY_EXTRUDER_ID(1), UI right = MAIN_EXTRUDER_ID(0)
|
||||
if (is_dual_extruder) {
|
||||
std::string printer_type = printer_preset.get_printer_type(wxGetApp().preset_bundle);
|
||||
auto left_title = DevPrinterConfigUtil::get_toolhead_display_name(printer_type, DEPUTY_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::TitleCase);
|
||||
auto right_title = DevPrinterConfigUtil::get_toolhead_display_name(printer_type, MAIN_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::TitleCase);
|
||||
p->left_extruder->SetTitle(_L(left_title));
|
||||
p->right_extruder->SetTitle(_L(right_title));
|
||||
}
|
||||
|
||||
auto extruders_def = printer_preset.config.def()->get("extruder_type");
|
||||
auto extruders = printer_preset.config.option<ConfigOptionEnumsGeneric>("extruder_type");
|
||||
auto nozzle_volumes_def = wxGetApp().preset_bundle->project_config.def()->get("nozzle_volume_type");
|
||||
auto nozzle_volumes = wxGetApp().preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
|
||||
auto diameters = wxGetApp().preset_bundle->printers.diameters_of_selected_printer();
|
||||
auto diameter = printer_preset.config.opt_string("printer_variant");
|
||||
auto extruder_max_nozzle_count = printer_preset.config.option<ConfigOptionIntsNullable>("extruder_max_nozzle_count");
|
||||
auto update_extruder_variant = [printer_model, extruders_def, extruders, nozzle_volumes_def, nozzle_volumes, extruder_variants,diameter,extruder_max_nozzle_count](ExtruderGroup & extruder, int index) {
|
||||
extruder.combo_flow->Clear();
|
||||
auto type = extruders_def->enum_labels[extruders->values[index]];
|
||||
int select = -1;
|
||||
for (size_t i = 0; i < nozzle_volumes_def->enum_labels.size(); ++i) {
|
||||
if (boost::algorithm::contains(extruder_variants->values[index], type + " " + nozzle_volumes_def->enum_labels[i]) /*||
|
||||
extruder_max_nozzle_count->values[index] > 1 && nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == nvtHybrid*/) { // TODO: Orca: Support hybrid
|
||||
if (nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == NozzleVolumeType::nvtHighFlow &&(diameter == "0.2" ||
|
||||
is_skip_high_flow_printer(printer_model)))
|
||||
continue;
|
||||
if (nozzle_volumes->values[index] == i)
|
||||
select = extruder.combo_flow->GetCount();
|
||||
extruder.combo_flow->Append(_L(nozzle_volumes_def->enum_labels[i]), {}, (void*)i);
|
||||
}
|
||||
}
|
||||
if (select == -1)
|
||||
select = extruder.combo_flow->GetCount() - 1;
|
||||
extruder.combo_flow->SetSelection(select);
|
||||
};
|
||||
|
||||
auto update_extruder_diameter = [&diameters, &diameter, &nozzle_diameter](int extruder_index,ExtruderGroup & extruder) {
|
||||
extruder.combo_diameter->Clear();
|
||||
int select = -1;
|
||||
@@ -2676,6 +2754,8 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
p->right_extruder->SetTitle(_L(DevPrinterConfigUtil::get_toolhead_display_name(printer_type, MAIN_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::TitleCase)));
|
||||
AMSCountPopupWindow::UpdateAMSCount(0, p->left_extruder);
|
||||
AMSCountPopupWindow::UpdateAMSCount(1, p->right_extruder);
|
||||
update_extruder_variant(*p->left_extruder, 0);
|
||||
update_extruder_variant(*p->right_extruder, 1);
|
||||
//if (!p->is_switching_diameter) {
|
||||
update_extruder_diameter(0, *p->left_extruder);
|
||||
update_extruder_diameter(1, *p->right_extruder);
|
||||
@@ -2683,6 +2763,7 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
p->image_printer_bed->SetBitmap(create_scaled_bitmap(image_path, this, PRINTER_THUMBNAIL_SIZE.GetHeight()));
|
||||
} else {
|
||||
AMSCountPopupWindow::UpdateAMSCount(0, p->single_extruder);
|
||||
update_extruder_variant(*p->single_extruder, 0);
|
||||
//if (!p->is_switching_diameter)
|
||||
update_extruder_diameter(0, *p->single_extruder);
|
||||
|
||||
@@ -12651,59 +12732,56 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
|
||||
DynamicPrintConfig& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
double nozzle_diameter = printer_config->option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
|
||||
filament_config->set_key_value("filament_retract_when_changing_layer", new ConfigOptionBoolsNullable{false});
|
||||
filament_config->set_key_value("filament_wipe", new ConfigOptionBoolsNullable{false});
|
||||
printer_config->set_key_value("wipe", new ConfigOptionBools{false});
|
||||
printer_config->set_key_value("retract_when_changing_layer", new ConfigOptionBools{false});
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
set_config_values<bool, ConfigOptionBoolsNullable>(filament_config, "filament_retract_when_changing_layer", false);
|
||||
set_config_values<bool, ConfigOptionBoolsNullable>(filament_config, "filament_wipe", false);
|
||||
set_config_values<bool, ConfigOptionBools>(printer_config, "wipe", false);
|
||||
set_config_values<bool, ConfigOptionBools>(printer_config, "retract_when_changing_layer", false);
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool(false));
|
||||
|
||||
//Orca: find acceleration to use in the test
|
||||
auto accel = print_config.option<ConfigOptionFloat>("outer_wall_acceleration")->value; // get the outer wall acceleration
|
||||
auto accel = print_config.get_abs_value_at("outer_wall_acceleration", params.extruder_id); // get the outer wall acceleration
|
||||
if (accel == 0) // if outer wall accel isnt defined, fall back to inner wall accel
|
||||
accel = print_config.option<ConfigOptionFloat>("inner_wall_acceleration")->value;
|
||||
accel = print_config.get_abs_value_at("inner_wall_acceleration", params.extruder_id);
|
||||
if (accel == 0) // if inner wall accel is not defined fall back to default accel
|
||||
accel = print_config.option<ConfigOptionFloat>("default_acceleration")->value;
|
||||
accel = print_config.get_abs_value_at("default_acceleration", params.extruder_id);
|
||||
// Orca: Set all accelerations except first layer, as the first layer accel doesnt affect the PA test since accel
|
||||
// is set to the travel accel before printing the pattern.
|
||||
if (accels.empty()) {
|
||||
accels.assign({accel});
|
||||
const auto msg{_L("INFO:") + "\n" +
|
||||
_L("No accelerations provided for calibration. Use default acceleration value ") + std::to_string(long(accel)) + _L(u8"mm/s²")};
|
||||
get_notification_manager()->push_notification(msg.ToStdString());
|
||||
get_notification_manager()->push_notification(msg.utf8_string());
|
||||
} else {
|
||||
// set max acceleration in case of batch mode to get correct test pattern size
|
||||
accel = *std::max_element(accels.begin(), accels.end());
|
||||
}
|
||||
print_config.set_key_value( "outer_wall_acceleration", new ConfigOptionFloat(accel));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "outer_wall_acceleration", accel);
|
||||
print_config.set_key_value( "print_sequence", new ConfigOptionEnum(PrintSequence::ByLayer));
|
||||
|
||||
//Orca: find jerk value to use in the test
|
||||
if(!has_junction_deviation(printer_config) && print_config.option<ConfigOptionFloat>("default_jerk")->value > 0){ // we have set a jerk value
|
||||
auto jerk = print_config.option<ConfigOptionFloat>("outer_wall_jerk")->value; // get outer wall jerk
|
||||
if(!has_junction_deviation(printer_config) && print_config.get_abs_value_at("default_jerk", params.extruder_id) > 0){ // we have set a jerk value
|
||||
auto jerk = print_config.get_abs_value_at("outer_wall_jerk", params.extruder_id); // get outer wall jerk
|
||||
if (jerk == 0) // if outer wall jerk is not defined, get inner wall jerk
|
||||
jerk = print_config.option<ConfigOptionFloat>("inner_wall_jerk")->value;
|
||||
jerk = print_config.get_abs_value_at("inner_wall_jerk", params.extruder_id);
|
||||
if (jerk == 0) // if inner wall jerk is not defined, get the default jerk
|
||||
jerk = print_config.option<ConfigOptionFloat>("default_jerk")->value;
|
||||
jerk = print_config.get_abs_value_at("default_jerk", params.extruder_id);
|
||||
|
||||
//Orca: Set jerk values. Again first layer jerk should not matter as it is reset to the travel jerk before the
|
||||
// first PA pattern is printed.
|
||||
print_config.set_key_value( "default_jerk", new ConfigOptionFloat(jerk));
|
||||
print_config.set_key_value( "outer_wall_jerk", new ConfigOptionFloat(jerk));
|
||||
print_config.set_key_value( "inner_wall_jerk", new ConfigOptionFloat(jerk));
|
||||
print_config.set_key_value( "top_surface_jerk", new ConfigOptionFloat(jerk));
|
||||
print_config.set_key_value( "infill_jerk", new ConfigOptionFloat(jerk));
|
||||
print_config.set_key_value( "travel_jerk", new ConfigOptionFloat(jerk));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "default_jerk", jerk);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "outer_wall_jerk", jerk);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "inner_wall_jerk", jerk);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "top_surface_jerk", jerk);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "infill_jerk", jerk);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "travel_jerk", jerk);
|
||||
}
|
||||
|
||||
if (has_junction_deviation(printer_config)){
|
||||
print_config.set_key_value("default_junction_deviation", new ConfigOptionFloat(0));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "default_junction_deviation", 0);
|
||||
}
|
||||
|
||||
for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) {
|
||||
print_config.set_key_value(
|
||||
opt.first,
|
||||
new ConfigOptionFloat(opt.second)
|
||||
);
|
||||
|
||||
for (const auto& opt : SuggestedConfigCalibPAPattern().floats_pairs) {
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, opt.first, opt.second[0]);
|
||||
}
|
||||
|
||||
for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
|
||||
@@ -12727,20 +12805,21 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
|
||||
|
||||
// Orca: Set the outer wall speed to the optimal speed for the test, cap it with max volumetric speed
|
||||
if (speeds.empty()) {
|
||||
// TODO: per-variant cap
|
||||
double speed = CalibPressureAdvance::find_optimal_PA_speed(
|
||||
wxGetApp().preset_bundle->full_config(),
|
||||
print_config.get_abs_value("line_width", nozzle_diameter),
|
||||
print_config.get_abs_value("layer_height"), 0, 0);
|
||||
print_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(speed));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "outer_wall_speed", speed);
|
||||
|
||||
speeds.assign({speed});
|
||||
const auto msg{_L("INFO:") + "\n" +
|
||||
_L("No speeds provided for calibration. Use default optimal speed ") + std::to_string(long(speed)) + _L("mm/s")};
|
||||
get_notification_manager()->push_notification(msg.ToStdString());
|
||||
get_notification_manager()->push_notification(msg.utf8_string());
|
||||
} else if (speeds.size() == 1) {
|
||||
// If we have single value provided, set speed using global configuration.
|
||||
// per-object config is not set in this case
|
||||
print_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(speeds.front()));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(&print_config, "outer_wall_speed", speeds.front());
|
||||
}
|
||||
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
|
||||
@@ -12815,9 +12894,9 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
|
||||
|
||||
auto &obj_config = obj->config;
|
||||
if (speeds.size() > 1)
|
||||
obj_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(tspd));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(obj_config, "outer_wall_speed", tspd);
|
||||
if (accels.size() > 1)
|
||||
obj_config.set_key_value("outer_wall_acceleration", new ConfigOptionFloat(tacc));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(obj_config, "outer_wall_acceleration", tacc);
|
||||
|
||||
auto cur_plate = get_partplate_list().get_plate(plate_idx);
|
||||
if (!cur_plate) {
|
||||
@@ -12918,11 +12997,8 @@ void Plater::_calib_pa_tower(const Calib_Params& params) {
|
||||
|
||||
obj_cfg.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
|
||||
auto full_config = wxGetApp().preset_bundle->full_config();
|
||||
auto wall_speed = CalibPressureAdvance::find_optimal_PA_speed(
|
||||
full_config, full_config.get_abs_value("line_width", nozzle_diameter),
|
||||
full_config.get_abs_value("layer_height"), 0, 0);
|
||||
obj_cfg.set_key_value("outer_wall_speed", new ConfigOptionFloat(wall_speed));
|
||||
obj_cfg.set_key_value("inner_wall_speed", new ConfigOptionFloat(wall_speed));
|
||||
update_speed_parameter("outer_wall_speed");
|
||||
update_speed_parameter("inner_wall_speed");
|
||||
obj_cfg.set_key_value("seam_position", new ConfigOptionEnum<SeamPosition>(spRear));
|
||||
obj_cfg.set_key_value("wall_loops", new ConfigOptionInt(2));
|
||||
obj_cfg.set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
@@ -12975,12 +13051,15 @@ void Plater::_calib_pa_select_added_objects() {
|
||||
void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, int pass, InfillPattern pattern)
|
||||
{
|
||||
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
/// --- scale ---
|
||||
// model is created for a 0.4 nozzle, scale z with nozzle size.
|
||||
const ConfigOptionFloats* nozzle_diameter_config = printerConfig->option<ConfigOptionFloats>("nozzle_diameter");
|
||||
const ConfigOptionFloats* nozzle_diameter_config = printer_config->option<ConfigOptionFloats>("nozzle_diameter");
|
||||
std::vector<int> extruder_types = printer_config->option<ConfigOptionEnumsGeneric>("extruder_type")->values;
|
||||
std::vector<int> nozzle_volume_types = wxGetApp().preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type")->values;
|
||||
|
||||
assert(nozzle_diameter_config->values.size() > 0);
|
||||
float nozzle_diameter = nozzle_diameter_config->values[0];
|
||||
float xyScale = nozzle_diameter / 0.6;
|
||||
@@ -13004,17 +13083,9 @@ void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, i
|
||||
}
|
||||
canvas->do_scale("");
|
||||
|
||||
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
|
||||
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
|
||||
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
|
||||
double max_infill_speed;
|
||||
if (linear)
|
||||
max_infill_speed = filament_max_volumetric_speed /
|
||||
(infill_flow.mm3_per_mm() * (cur_flowrate + (pass == 2 ? 0.035 : 0.05)) / cur_flowrate);
|
||||
else
|
||||
max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
|
||||
double internal_solid_speed = std::floor(std::min(print_config->opt_float("internal_solid_infill_speed"), max_infill_speed));
|
||||
double top_surface_speed = std::floor(std::min(print_config->opt_float("top_surface_speed"), max_infill_speed));
|
||||
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0); // TODO: per-filament param
|
||||
std::vector<double> internal_solid_speeds = generate_max_speed_parameter_value("internal_solid_infill_speed", linear, pass);
|
||||
std::vector<double> top_surface_speeds = generate_max_speed_parameter_value("top_surface_speed", linear, pass);
|
||||
|
||||
// adjust parameters
|
||||
for (auto _obj : objects) {
|
||||
@@ -13042,8 +13113,8 @@ void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, i
|
||||
_obj->config.set_key_value("solid_infill_direction", new ConfigOptionFloat(135));
|
||||
_obj->config.set_key_value("align_infill_direction_to_model", new ConfigOptionBool(true));
|
||||
_obj->config.set_key_value("ironing_type", new ConfigOptionEnum<IroningType>(IroningType::NoIroning));
|
||||
_obj->config.set_key_value("internal_solid_infill_speed", new ConfigOptionFloat(internal_solid_speed));
|
||||
_obj->config.set_key_value("top_surface_speed", new ConfigOptionFloat(top_surface_speed));
|
||||
_obj->config.set_key_value("internal_solid_infill_speed", new ConfigOptionFloatsNullable(internal_solid_speeds));
|
||||
_obj->config.set_key_value("top_surface_speed", new ConfigOptionFloatsNullable(top_surface_speeds));
|
||||
_obj->config.set_key_value("seam_slope_type", new ConfigOptionEnum<SeamScarfType>(SeamScarfType::None));
|
||||
_obj->config.set_key_value("gap_fill_target", new ConfigOptionEnum<GapFillTarget>(GapFillTarget::gftNowhere));
|
||||
print_config->set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0));
|
||||
@@ -13140,8 +13211,7 @@ void Plater::calib_temp(const Calib_Params& params) {
|
||||
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");
|
||||
new_project(false, false, calib_temp_name);
|
||||
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||
if (params.mode != CalibMode::Calib_Temp_Tower)
|
||||
return;
|
||||
if (params.mode != CalibMode::Calib_Temp_Tower) return;
|
||||
|
||||
add_model(false, Slic3r::resources_dir() + "/calib/temperature_tower/temperature_tower.drc");
|
||||
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
@@ -13187,8 +13257,8 @@ void Plater::calib_temp(const Calib_Params& params) {
|
||||
model().objects[0]->ensure_on_bed();
|
||||
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
filament_config->set_key_value("nozzle_temperature_initial_layer", new ConfigOptionInts(1,(int)start_temp));
|
||||
filament_config->set_key_value("nozzle_temperature", new ConfigOptionInts(1,(int)start_temp));
|
||||
set_config_values<int, ConfigOptionInts>(filament_config, "nozzle_temperature_initial_layer", (int) start_temp);
|
||||
set_config_values<int, ConfigOptionInts>(filament_config, "nozzle_temperature", (int) start_temp);
|
||||
model().objects[0]->config.set_key_value("layer_height", new ConfigOptionFloat(nozzle_diameter/2));
|
||||
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
|
||||
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(5.0));
|
||||
@@ -13240,13 +13310,15 @@ void Plater::calib_max_vol_speed(const Calib_Params& params)
|
||||
double layer_height = nozzle_diameter * 0.8;
|
||||
|
||||
auto max_lh = printer_config->option<ConfigOptionFloats>("max_layer_height");
|
||||
if (max_lh->values[0] < layer_height)
|
||||
max_lh->values[0] = { layer_height };
|
||||
for (size_t i = 0; i < max_lh->values.size(); ++i) {
|
||||
if (max_lh->values[i] < layer_height)
|
||||
max_lh->values[i] = layer_height;
|
||||
}
|
||||
|
||||
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats { 200 });
|
||||
set_config_values<double, ConfigOptionFloats>(filament_config, "filament_max_volumetric_speed", 200);
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{0.0});
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
obj_cfg.set_key_value("enable_overhang_speed", new ConfigOptionBool { false });
|
||||
set_config_values<bool, ConfigOptionBoolsNullable>(obj_cfg, "enable_overhang_speed", false);
|
||||
obj_cfg.set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
obj_cfg.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
|
||||
obj_cfg.set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
@@ -13315,8 +13387,9 @@ void Plater::calib_retraction(const Calib_Params& params)
|
||||
}
|
||||
|
||||
auto max_lh = printer_config->option<ConfigOptionFloats>("max_layer_height");
|
||||
if (max_lh->values[0] < layer_height)
|
||||
max_lh->values[0] = { layer_height };
|
||||
for (size_t i = 0; i < max_lh->values.size(); ++i) {
|
||||
if (max_lh->values[i] < layer_height) max_lh->values[i] = layer_height;
|
||||
}
|
||||
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
printer_config->set_key_value("use_firmware_retraction", new ConfigOptionBool(false));
|
||||
@@ -13359,7 +13432,7 @@ void Plater::calib_VFA(const Calib_Params& params)
|
||||
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats { 0.0 });
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool { false });
|
||||
set_config_values<bool, ConfigOptionBoolsNullable>(print_config, "enable_overhang_speed", false);
|
||||
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
|
||||
@@ -13406,18 +13479,18 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params)
|
||||
|
||||
if (has_junction_deviation(printer_config)) {
|
||||
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats {(std::max(printer_config->option<ConfigOptionFloats>("machine_max_junction_deviation")->values.front(), 0.25))});
|
||||
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(0));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_junction_deviation", 0);
|
||||
} else {
|
||||
const double jerk_value = (gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfKlipper) ? 5.0 : 10.0;
|
||||
printer_config->set_key_value("machine_max_jerk_x", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_x")->values.front(), jerk_value)});
|
||||
printer_config->set_key_value("machine_max_jerk_y", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_y")->values.front(), jerk_value)});
|
||||
print_config->set_key_value("default_jerk", new ConfigOptionFloat(0));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_jerk", 0);
|
||||
}
|
||||
|
||||
if (!filament_config->option<ConfigOptionBools>("enable_pressure_advance")->get_at(0)) {
|
||||
filament_config->set_key_value("enable_pressure_advance", new ConfigOptionBools {true});
|
||||
filament_config->set_key_value("pressure_advance", new ConfigOptionFloats { 0.0 });
|
||||
filament_config->set_key_value("adaptive_pressure_advance", new ConfigOptionBools{false});
|
||||
set_config_values<bool, ConfigOptionBools>(filament_config, "enable_pressure_advance", true);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(filament_config, "pressure_advance", 0.0);
|
||||
set_config_values<bool, ConfigOptionBools>(filament_config, "adaptive_pressure_advance", false);
|
||||
}
|
||||
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
@@ -13426,7 +13499,7 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params)
|
||||
filament_config->set_key_value("slow_down_min_speed", new ConfigOptionFloats { 0.0 });
|
||||
filament_config->set_key_value("slow_down_for_layer_cooling", new ConfigOptionBools{false});
|
||||
print_config->set_key_value("layer_height", new ConfigOptionFloat(0.2));
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
|
||||
set_config_values<bool, ConfigOptionBools>(print_config, "enable_overhang_speed", false);
|
||||
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
@@ -13436,9 +13509,9 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params)
|
||||
print_config->set_key_value("spiral_mode", new ConfigOptionBool(true));
|
||||
print_config->set_key_value("spiral_mode_smooth", new ConfigOptionBool(false));
|
||||
print_config->set_key_value("bottom_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
|
||||
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(200));
|
||||
print_config->set_key_value("default_acceleration", new ConfigOptionFloat(20000));
|
||||
print_config->set_key_value("outer_wall_acceleration", new ConfigOptionFloat(20000));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "outer_wall_speed", 200.);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_acceleration", 20000.);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "outer_wall_acceleration", 20000.);
|
||||
print_config->set_key_value("precise_z_height", new ConfigOptionBool(false));
|
||||
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
|
||||
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(3.0));
|
||||
@@ -13469,18 +13542,18 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params)
|
||||
|
||||
if (has_junction_deviation(printer_config)) {
|
||||
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats {(std::max(printer_config->option<ConfigOptionFloats>("machine_max_junction_deviation")->values.front(), 0.25))});
|
||||
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(0));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_junction_deviation", 0);
|
||||
} else {
|
||||
const double jerk_value = (gcode_flavor_option && gcode_flavor_option->value == GCodeFlavor::gcfKlipper) ? 5.0 : 10.0;
|
||||
printer_config->set_key_value("machine_max_jerk_x", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_x")->values.front(), jerk_value)});
|
||||
printer_config->set_key_value("machine_max_jerk_y", new ConfigOptionFloats{std::max(printer_config->option<ConfigOptionFloats>("machine_max_jerk_y")->values.front(), jerk_value)});
|
||||
print_config->set_key_value("default_jerk", new ConfigOptionFloat(0));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_jerk", 0);
|
||||
}
|
||||
|
||||
if (!filament_config->option<ConfigOptionBools>("enable_pressure_advance")->get_at(0)) {
|
||||
filament_config->set_key_value("enable_pressure_advance", new ConfigOptionBools {true});
|
||||
filament_config->set_key_value("pressure_advance", new ConfigOptionFloats { 0.0 });
|
||||
filament_config->set_key_value("adaptive_pressure_advance", new ConfigOptionBools{false});
|
||||
set_config_values<bool, ConfigOptionBools>(filament_config, "enable_pressure_advance", true);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(filament_config, "pressure_advance", 0.0);
|
||||
set_config_values<bool, ConfigOptionBools>(filament_config, "adaptive_pressure_advance", false);
|
||||
}
|
||||
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
@@ -13488,7 +13561,7 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params)
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats { 0.0 });
|
||||
filament_config->set_key_value("slow_down_min_speed", new ConfigOptionFloats { 0.0 });
|
||||
filament_config->set_key_value("slow_down_for_layer_cooling", new ConfigOptionBools{false});
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
|
||||
set_config_values<bool, ConfigOptionBools>(print_config, "enable_overhang_speed", false);
|
||||
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
@@ -13498,9 +13571,9 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params)
|
||||
print_config->set_key_value("spiral_mode", new ConfigOptionBool(true));
|
||||
print_config->set_key_value("spiral_mode_smooth", new ConfigOptionBool(false));
|
||||
print_config->set_key_value("bottom_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
|
||||
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(200));
|
||||
print_config->set_key_value("default_acceleration", new ConfigOptionFloat(20000));
|
||||
print_config->set_key_value("outer_wall_acceleration", new ConfigOptionFloat(20000));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "outer_wall_speed", 200.);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_acceleration", 20000.);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "outer_wall_acceleration", 20000.);
|
||||
print_config->set_key_value("precise_z_height", new ConfigOptionBool(false));
|
||||
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
|
||||
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(3.0));
|
||||
@@ -13533,17 +13606,17 @@ void Plater::Calib_Cornering(const Calib_Params& params)
|
||||
|
||||
if (has_junction_deviation(printer_config)) {
|
||||
printer_config->set_key_value("machine_max_junction_deviation", new ConfigOptionFloats{params.end});
|
||||
print_config->set_key_value("default_junction_deviation", new ConfigOptionFloat(0.0));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_junction_deviation", 0);
|
||||
} else {
|
||||
printer_config->set_key_value("machine_max_jerk_x", new ConfigOptionFloats{params.end});
|
||||
printer_config->set_key_value("machine_max_jerk_y", new ConfigOptionFloats{params.end});
|
||||
print_config->set_key_value("default_jerk", new ConfigOptionFloat(0));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_jerk", 0);
|
||||
}
|
||||
|
||||
if (!filament_config->option<ConfigOptionBools>("enable_pressure_advance")->get_at(0)) {
|
||||
filament_config->set_key_value("enable_pressure_advance", new ConfigOptionBools {true});
|
||||
filament_config->set_key_value("pressure_advance", new ConfigOptionFloats { 0.0 });
|
||||
filament_config->set_key_value("adaptive_pressure_advance", new ConfigOptionBools{false});
|
||||
set_config_values<bool, ConfigOptionBools>(filament_config, "enable_pressure_advance", true);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(filament_config, "pressure_advance", 0.0);
|
||||
set_config_values<bool, ConfigOptionBools>(filament_config, "adaptive_pressure_advance", false);
|
||||
}
|
||||
|
||||
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
|
||||
@@ -13553,7 +13626,7 @@ void Plater::Calib_Cornering(const Calib_Params& params)
|
||||
filament_config->set_key_value("slow_down_min_speed", new ConfigOptionFloats { 0.0 });
|
||||
filament_config->set_key_value("slow_down_for_layer_cooling", new ConfigOptionBools{false});
|
||||
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{200});
|
||||
print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool{false});
|
||||
set_config_values<bool, ConfigOptionBools>(print_config, "enable_overhang_speed", false);
|
||||
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
|
||||
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
|
||||
print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0));
|
||||
@@ -13563,9 +13636,9 @@ void Plater::Calib_Cornering(const Calib_Params& params)
|
||||
print_config->set_key_value("spiral_mode", new ConfigOptionBool(true));
|
||||
print_config->set_key_value("spiral_mode_smooth", new ConfigOptionBool(false));
|
||||
print_config->set_key_value("bottom_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
|
||||
print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(200));
|
||||
print_config->set_key_value("default_acceleration", new ConfigOptionFloat(2000));
|
||||
print_config->set_key_value("outer_wall_acceleration", new ConfigOptionFloat(2000));
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "outer_wall_speed", 200.);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "default_acceleration", 2000.);
|
||||
set_config_values<double, ConfigOptionFloatsNullable>(print_config, "outer_wall_acceleration", 2000.);
|
||||
print_config->set_key_value("precise_z_height", new ConfigOptionBool(false));
|
||||
model().objects[0]->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterOnly));
|
||||
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(3.0));
|
||||
|
||||
Reference in New Issue
Block a user