Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Added an option to enable multiple bed type support for printers
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftFever committed Jan 4, 2024
1 parent 6902098 commit cf0d5de
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ static std::vector<std::string> s_Preset_printer_options {
"cooling_tube_retraction",
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "purge_in_prime_tower", "enable_filament_ramming",
"z_offset",
"disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode"
"disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode", "support_multi_bed_types"
};

static std::vector<std::string> s_Preset_sla_print_options {
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|| opt_key == "enable_filament_ramming"
|| opt_key == "purge_in_prime_tower"
|| opt_key == "z_offset"
|| opt_key == "support_multi_bed_types"
) {
steps.emplace_back(psWipeTower);
steps.emplace_back(psSkirtBrim);
Expand Down
6 changes: 6 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,12 @@ def = this->add("filament_loading_speed", coFloats);
def->readonly = false;
def->set_default_value(new ConfigOptionEnum<GCodeFlavor>(gcfMarlinLegacy));

def = this->add("support_multi_bed_types", coBool);
def->label = L("Support multi bed types");
def->tooltip = L("Enable this option if you want to use multiple bed types");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("gcode_label_objects", coBool);
def->label = L("Label objects");
def->tooltip = L("Enable this to add comments into the G-Code labeling print moves with what object they belong to,"
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloats, filament_multitool_ramming_flow))
((ConfigOptionBool, purge_in_prime_tower))
((ConfigOptionBool, enable_filament_ramming))
((ConfigOptionBool, support_multi_bed_types))

)

Expand Down
42 changes: 18 additions & 24 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ void Sidebar::update_all_preset_comboboxes()
// Orca:: show device tab based on vendor type
auto p_mainframe = wxGetApp().mainframe;
p_mainframe->show_device(is_bbl_vendor);
auto cfg = preset_bundle.printers.get_edited_preset().config;

if (is_bbl_vendor) {
//only show connection button for not-BBL printer
Expand All @@ -1140,32 +1141,9 @@ void Sidebar::update_all_preset_comboboxes()
ams_btn->Show();
//update print button default value for bbl or third-party printer
p_mainframe->set_print_button_to_default(MainFrame::PrintSelectType::ePrintPlate);
AppConfig* config = wxGetApp().app_config;
if (config && !config->get("curr_bed_type").empty()) {
int bed_type_idx = 0;
std::string str_bed_type = config->get("curr_bed_type");
int bed_type_value = (int)btPC;
try {
bed_type_value = atoi(str_bed_type.c_str());
} catch(...) {}
bed_type_idx = bed_type_value - 1;
m_bed_type_list->SelectAndNotify(bed_type_idx);
} else {
BedType bed_type = preset_bundle.printers.get_edited_preset().get_default_bed_type(&preset_bundle);
m_bed_type_list->SelectAndNotify((int)bed_type - 1);
}
m_bed_type_list->Enable();
auto str_bed_type = wxGetApp().app_config->get_printer_setting(wxGetApp().preset_bundle->printers.get_selected_preset_name(), "curr_bed_type");
if(!str_bed_type.empty()){
int bed_type_value = atoi(str_bed_type.c_str());
if(bed_type_value == 0)
bed_type_value = 1;
m_bed_type_list->SelectAndNotify(bed_type_value - 1);
}
} else {
connection_btn->Show();
ams_btn->Hide();
auto cfg = preset_bundle.printers.get_edited_preset().config;
auto print_btn_type = MainFrame::PrintSelectType::eExportGcode;
wxString url = cfg.opt_string("print_host_webui").empty() ? cfg.opt_string("print_host") : cfg.opt_string("print_host_webui");
if(!url.empty())
Expand All @@ -1182,7 +1160,23 @@ void Sidebar::update_all_preset_comboboxes()
}
p_mainframe->set_print_button_to_default(print_btn_type);

m_bed_type_list->SelectAndNotify(btPEI-1);
}

if (is_bbl_vendor || cfg.opt_bool("support_multi_bed_types")) {
m_bed_type_list->Enable();
auto str_bed_type = wxGetApp().app_config->get_printer_setting(wxGetApp().preset_bundle->printers.get_selected_preset_name(),
"curr_bed_type");
if (!str_bed_type.empty()) {
int bed_type_value = atoi(str_bed_type.c_str());
if (bed_type_value == 0)
bed_type_value = 1;
m_bed_type_list->SelectAndNotify(bed_type_value - 1);
} else {
BedType bed_type = preset_bundle.printers.get_edited_preset().get_default_bed_type(&preset_bundle);
m_bed_type_list->SelectAndNotify((int) bed_type - 1);
}
} else {
m_bed_type_list->SelectAndNotify(btPEI - 1);
m_bed_type_list->Disable();
}

Expand Down
17 changes: 9 additions & 8 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3028,6 +3028,7 @@ void TabFilament::build()
line.append_option(optgroup->get_option("nozzle_temperature"));
optgroup->append_line(line);

optgroup = page->new_optgroup(L("Bed temperature"), L"param_temperature");
line = { L("Cool plate"), L("Bed temperature when cool plate is installed. Value 0 means the filament does not support to print on the Cool Plate") };
line.append_option(optgroup->get_option("cool_plate_temp_initial_layer"));
line.append_option(optgroup->get_option("cool_plate_temp"));
Expand Down Expand Up @@ -3277,23 +3278,22 @@ void TabFilament::toggle_options()
wxGetApp().preset_bundle->is_bbl_vendor();
}

auto cfg = m_preset_bundle->printers.get_edited_preset().config;
if (m_active_page->title() == L("Cooling")) {
bool has_enable_overhang_bridge_fan = m_config->opt_bool("enable_overhang_bridge_fan", 0);
for (auto el : {"overhang_fan_speed", "overhang_fan_threshold"})
toggle_option(el, has_enable_overhang_bridge_fan);

toggle_option(
"additional_cooling_fan_speed",
m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionBool>("auxiliary_fan")->value);
toggle_option("additional_cooling_fan_speed", cfg.opt_bool("auxiliary_fan"));
}
if (m_active_page->title() == L("Filament"))
{
bool pa = m_config->opt_bool("enable_pressure_advance", 0);
toggle_option("pressure_advance", pa);

toggle_line("cool_plate_temp_initial_layer", is_BBL_printer);
toggle_line("eng_plate_temp_initial_layer", is_BBL_printer);
toggle_line("textured_plate_temp_initial_layer", is_BBL_printer);
auto support_multi_bed_types = is_BBL_printer || cfg.opt_bool("support_multi_bed_types");
toggle_line("cool_plate_temp_initial_layer", support_multi_bed_types );
toggle_line("eng_plate_temp_initial_layer", support_multi_bed_types);
toggle_line("textured_plate_temp_initial_layer", support_multi_bed_types);

}
if (m_active_page->title() == L("Setting Overrides"))
Expand Down Expand Up @@ -3406,6 +3406,7 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line(option);
// optgroup->append_single_option_line("printable_area");
optgroup->append_single_option_line("printable_height");
optgroup->append_single_option_line("support_multi_bed_types");
optgroup->append_single_option_line("nozzle_volume");
optgroup->append_single_option_line("best_object_pos");
optgroup->append_single_option_line("z_offset");
Expand Down Expand Up @@ -4057,7 +4058,7 @@ void TabPrinter::toggle_options()
toggle_line(el, is_BBL_printer);

// SoftFever: hide non-BBL settings
for (auto el : {"use_firmware_retraction", "use_relative_e_distances"})
for (auto el : {"use_firmware_retraction", "use_relative_e_distances", "support_multi_bed_types"})
toggle_line(el, !is_BBL_printer);
}

Expand Down

0 comments on commit cf0d5de

Please sign in to comment.