mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00:00
ENH: Add parameters for extruder page of printer preset
jira: none Change-Id: I8eb37e41bdc4b2b1f2328acee324c6fad30e391c (cherry picked from commit d0f89eb8628b4225fc2c6a7b9f2a2eb49bb4f05a)
This commit is contained in:
@@ -663,13 +663,13 @@ void PrintConfigDef::init_common_params()
|
|||||||
def->set_default_value(new ConfigOptionFloat(100.0));
|
def->set_default_value(new ConfigOptionFloat(100.0));
|
||||||
|
|
||||||
def = this->add("extruder_printable_height", coFloats);
|
def = this->add("extruder_printable_height", coFloats);
|
||||||
def->label = L("Printable height");
|
def->label = L("Extruder printable height");
|
||||||
def->tooltip = L("Maximum printable height which is limited by mechanism of printer");
|
def->tooltip = L("Maximum printable height of the extruder");
|
||||||
def->sidetext = L("mm");
|
def->sidetext = L("mm");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->max = 1000;
|
def->max = 1000;
|
||||||
def->mode = comSimple;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionFloatsNullable{});
|
def->set_default_value(new ConfigOptionFloatsNullable{0});
|
||||||
|
|
||||||
def = this->add("unprintable_filament_types", coStrings);
|
def = this->add("unprintable_filament_types", coStrings);
|
||||||
def->label = L("Unprintable filament type");
|
def->label = L("Unprintable filament type");
|
||||||
@@ -7384,6 +7384,7 @@ std::set<std::string> printer_extruder_options = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::set<std::string> printer_options_with_variant_1 = {
|
std::set<std::string> printer_options_with_variant_1 = {
|
||||||
|
"nozzle_volume",
|
||||||
"retraction_length",
|
"retraction_length",
|
||||||
"z_hop",
|
"z_hop",
|
||||||
"retract_lift_above",
|
"retract_lift_above",
|
||||||
|
|||||||
@@ -1017,13 +1017,22 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||||||
case coPercents:
|
case coPercents:
|
||||||
case coFloats:
|
case coFloats:
|
||||||
case coFloat:{
|
case coFloat:{
|
||||||
double val = opt->type == coFloats ?
|
if (opt_key == "extruder_printable_height") {
|
||||||
config.opt_float(opt_key, idx) :
|
auto opt_values = dynamic_cast<const ConfigOptionFloatsNullable *>(config.option(opt_key))->values;
|
||||||
opt->type == coFloat ? config.opt_float(opt_key) :
|
if (!opt_values.empty()) {
|
||||||
config.option<ConfigOptionPercents>(opt_key)->get_at(idx);
|
double val = opt_values[idx];
|
||||||
ret = double_to_string(val);
|
ret = double_to_string(val);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
else {
|
||||||
|
double val = opt->type == coFloats ?
|
||||||
|
config.opt_float(opt_key, idx) :
|
||||||
|
opt->type == coFloat ? config.opt_float(opt_key) :
|
||||||
|
config.option<ConfigOptionPercents>(opt_key)->get_at(idx);
|
||||||
|
ret = double_to_string(val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case coString:
|
case coString:
|
||||||
ret = from_u8(config.opt_string(opt_key));
|
ret = from_u8(config.opt_string(opt_key));
|
||||||
break;
|
break;
|
||||||
@@ -1089,6 +1098,15 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||||||
ret = get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
|
ret = get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
|
||||||
else
|
else
|
||||||
ret = config.option<ConfigOptionPoints>(opt_key)->get_at(idx);
|
ret = config.option<ConfigOptionPoints>(opt_key)->get_at(idx);
|
||||||
|
break;
|
||||||
|
case coPointsGroups:
|
||||||
|
if (opt_key == "extruder_printable_area") {
|
||||||
|
auto values = config.option<ConfigOptionPointsGroups>(opt_key)->values;
|
||||||
|
if (!values.empty())
|
||||||
|
ret = get_thumbnails_string(config.option<ConfigOptionPointsGroups>(opt_key)->get_at(idx));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ret = config.option<ConfigOptionPointsGroups>(opt_key)->get_at(idx);
|
||||||
break;
|
break;
|
||||||
case coNone:
|
case coNone:
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -4065,7 +4065,6 @@ void TabPrinter::build_fff()
|
|||||||
// optgroup->append_single_option_line("printable_area");
|
// optgroup->append_single_option_line("printable_area");
|
||||||
optgroup->append_single_option_line("printable_height");
|
optgroup->append_single_option_line("printable_height");
|
||||||
optgroup->append_single_option_line("support_multi_bed_types","bed-types");
|
optgroup->append_single_option_line("support_multi_bed_types","bed-types");
|
||||||
optgroup->append_single_option_line("nozzle_volume");
|
|
||||||
optgroup->append_single_option_line("best_object_pos");
|
optgroup->append_single_option_line("best_object_pos");
|
||||||
// todo: for multi_extruder test
|
// todo: for multi_extruder test
|
||||||
optgroup->append_single_option_line("z_offset");
|
optgroup->append_single_option_line("z_offset");
|
||||||
@@ -4618,10 +4617,16 @@ if (is_marlin_flavor)
|
|||||||
auto page = add_options_page(page_name, "custom-gcode_extruder", true); // ORCA: icon only visible on placeholders
|
auto page = add_options_page(page_name, "custom-gcode_extruder", true); // ORCA: icon only visible on placeholders
|
||||||
m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page);
|
m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page);
|
||||||
|
|
||||||
auto optgroup = page->new_optgroup(L("Size"), L"param_extruder_size");
|
auto optgroup = page->new_optgroup(L("Basic information"), L"param_type", -1, true);
|
||||||
optgroup->append_single_option_line("nozzle_diameter", "", extruder_idx);
|
optgroup->append_single_option_line("nozzle_diameter", "", extruder_idx);
|
||||||
//optgroup->append_single_option_line("nozzle_volume_type", "", extruder_idx);
|
//optgroup->append_single_option_line("nozzle_volume_type", "", extruder_idx);
|
||||||
|
|
||||||
|
optgroup->append_single_option_line("nozzle_volume", "", extruder_idx);
|
||||||
|
optgroup->append_single_option_line("extruder_printable_height", "", extruder_idx);
|
||||||
|
Option option = optgroup->get_option("extruder_printable_area", extruder_idx);
|
||||||
|
option.opt.full_width = true;
|
||||||
|
optgroup->append_single_option_line(option);
|
||||||
|
|
||||||
optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value)
|
optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value)
|
||||||
{
|
{
|
||||||
bool is_SEMM = m_config->opt_bool("single_extruder_multi_material");
|
bool is_SEMM = m_config->opt_bool("single_extruder_multi_material");
|
||||||
@@ -4910,6 +4915,11 @@ void TabPrinter::toggle_options()
|
|||||||
size_t i = size_t(val - 1);
|
size_t i = size_t(val - 1);
|
||||||
bool have_retract_length = m_config->opt_float("retraction_length", i) > 0;
|
bool have_retract_length = m_config->opt_float("retraction_length", i) > 0;
|
||||||
|
|
||||||
|
toggle_option("extruder_printable_area", false, i); // disable
|
||||||
|
toggle_line("extruder_printable_area", m_preset_bundle->get_printer_extruder_count() == 2, i); //hide
|
||||||
|
toggle_option("extruder_printable_height", false, i);
|
||||||
|
toggle_line("extruder_printable_height", m_preset_bundle->get_printer_extruder_count() == 2, i);
|
||||||
|
|
||||||
// when using firmware retraction, firmware decides retraction length
|
// when using firmware retraction, firmware decides retraction length
|
||||||
bool use_firmware_retraction = m_config->opt_bool("use_firmware_retraction");
|
bool use_firmware_retraction = m_config->opt_bool("use_firmware_retraction");
|
||||||
toggle_option("retract_length", !use_firmware_retraction, i);
|
toggle_option("retract_length", !use_firmware_retraction, i);
|
||||||
@@ -6610,7 +6620,7 @@ void Tab::switch_excluder(int extruder_id)
|
|||||||
for (auto page : m_pages) {
|
for (auto page : m_pages) {
|
||||||
bool is_extruder = false;
|
bool is_extruder = false;
|
||||||
page->m_opt_id_map.clear();
|
page->m_opt_id_map.clear();
|
||||||
if (m_extruder_switch == nullptr && page->title().StartsWith("Extruder ")) {
|
if (m_extruder_switch == nullptr && page->title().StartsWith("Extruder")) {
|
||||||
int extruder_id2 = std::atoi(page->title().Mid(9).ToUTF8()) - 1;
|
int extruder_id2 = std::atoi(page->title().Mid(9).ToUTF8()) - 1;
|
||||||
if (extruder_id >= 0 && extruder_id2 != extruder_id)
|
if (extruder_id >= 0 && extruder_id2 != extruder_id)
|
||||||
continue;
|
continue;
|
||||||
@@ -6619,12 +6629,13 @@ void Tab::switch_excluder(int extruder_id)
|
|||||||
is_extruder = true;
|
is_extruder = true;
|
||||||
}
|
}
|
||||||
for (auto group : page->m_optgroups) {
|
for (auto group : page->m_optgroups) {
|
||||||
if (is_extruder && group->title == "Type") {
|
|
||||||
for (auto &opt : group->opt_map())
|
|
||||||
page->m_opt_id_map.insert({opt.first, opt.first});
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (auto &opt : group->opt_map()) {
|
for (auto &opt : group->opt_map()) {
|
||||||
|
auto iter = std::find(printer_extruder_options.begin(), printer_extruder_options.end(), opt.second.first);
|
||||||
|
if (iter != printer_extruder_options.end()) {
|
||||||
|
page->m_opt_id_map.insert({opt.first, opt.first});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (opt.second.second >= 0) {
|
if (opt.second.second >= 0) {
|
||||||
const_cast<int &>(opt.second.second) = index;
|
const_cast<int &>(opt.second.second) = index;
|
||||||
page->m_opt_id_map.insert({opt.second.first + "#" + std::to_string(index), opt.first});
|
page->m_opt_id_map.insert({opt.second.first + "#" + std::to_string(index), opt.first});
|
||||||
|
|||||||
Reference in New Issue
Block a user