ENH: privide setting option of exclude_area

As title. User can delete the value to enable 256x256 printable
size

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: Ia10454b7a7a1b28c04d8d41df9f3251875f6e74e
This commit is contained in:
salt.wei 2022-07-25 18:32:05 +08:00 committed by Lane.Wei
parent f9dce93a52
commit 5a2669dcc2
7 changed files with 30 additions and 11 deletions

View File

@ -264,8 +264,11 @@ void PrintConfigDef::init_common_params()
//BBS: add "bed_exclude_area" //BBS: add "bed_exclude_area"
def = this->add("bed_exclude_area", coPoints); def = this->add("bed_exclude_area", coPoints);
def->label = L("Bed exclude area"); def->label = L("Bed exclude area");
def->mode = comDevelop; def->tooltip = L("Bed exclude area that can't used as printable area in X-Y plane. For example, the bottom left area which is used to cut filament in X1 when printing multi colors with AMS. "
def->set_default_value(new ConfigOptionPoints{}); "The area is expressed as polygon by points in following format: \"XxY, XxY, ...\"");
def->mode = comAdvanced;
def->gui_type = ConfigOptionDef::GUIType::one_string;
def->set_default_value(new ConfigOptionPoints{ Vec2d(0, 0) });
def = this->add("elefant_foot_compensation", coFloat); def = this->add("elefant_foot_compensation", coFloat);
def->label = L("Elephant foot compensation"); def->label = L("Elephant foot compensation");
@ -290,7 +293,6 @@ void PrintConfigDef::init_common_params()
def->sidetext = L("mm"); def->sidetext = L("mm");
def->min = 0; def->min = 0;
def->max = 1000; def->max = 1000;
def->readonly = true;
def->mode = comSimple; def->mode = comSimple;
def->set_default_value(new ConfigOptionFloat(100.0)); def->set_default_value(new ConfigOptionFloat(100.0));

View File

@ -374,9 +374,17 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) { if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) {
wxString y_str = thumbnail.GetNextToken(); wxString y_str = thumbnail.GetNextToken();
if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) { if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) {
if (0 < x && x < 1000 && 0 < y && y < 1000) { if (m_opt_id == "bed_exclude_area") {
out_values.push_back(Vec2d(x, y)); if (0 <= x && x <= 256 && 0 <= y && y <= 256) {
continue; out_values.push_back(Vec2d(x, y));
continue;
}
}
else {
if (0 < x && x < 1000 && 0 < y && y < 1000) {
out_values.push_back(Vec2d(x, y));
continue;
}
} }
out_of_range_val = true; out_of_range_val = true;
break; break;

View File

@ -197,7 +197,7 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
} }
break; break;
case coPoints:{ case coPoints:{
if (opt_key == "printable_area") { if (opt_key == "printable_area" || opt_key == "bed_exclude_area") {
config.option<ConfigOptionPoints>(opt_key)->values = boost::any_cast<std::vector<Vec2d>>(value); config.option<ConfigOptionPoints>(opt_key)->values = boost::any_cast<std::vector<Vec2d>>(value);
break; break;
} }

View File

@ -1022,6 +1022,8 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
case coPoints: case coPoints:
if (opt_key == "printable_area") if (opt_key == "printable_area")
ret = config.option<ConfigOptionPoints>(opt_key)->values; ret = config.option<ConfigOptionPoints>(opt_key)->values;
else if (opt_key == "bed_exclude_area")
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; break;
@ -1130,6 +1132,8 @@ boost::any ConfigOptionsGroup::get_config_value2(const DynamicPrintConfig& confi
case coPoints: case coPoints:
if (opt_key == "printable_area") if (opt_key == "printable_area")
ret = config.option<ConfigOptionPoints>(opt_key)->values; ret = config.option<ConfigOptionPoints>(opt_key)->values;
else if (opt_key == "bed_exclude_area")
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; break;

View File

@ -520,6 +520,7 @@ public:
Vec3d get_current_plate_origin() { return compute_origin(m_current_plate, m_plate_cols); } Vec3d get_current_plate_origin() { return compute_origin(m_current_plate, m_plate_cols); }
Vec2d get_current_shape_position() { return compute_shape_position(m_current_plate, m_plate_cols); } Vec2d get_current_shape_position() { return compute_shape_position(m_current_plate, m_plate_cols); }
Pointfs get_exclude_area() { return m_exclude_areas; }
//select plate //select plate
int select_plate(int index); int select_plate(int index);

View File

@ -5879,7 +5879,9 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
partplate_list.get_height_limits(prev_height_lid, prev_height_rod); partplate_list.get_height_limits(prev_height_lid, prev_height_rod);
double height_to_lid = config->opt_float("extruder_clearance_height_to_lid"); double height_to_lid = config->opt_float("extruder_clearance_height_to_lid");
double height_to_rod = config->opt_float("extruder_clearance_height_to_rod"); double height_to_rod = config->opt_float("extruder_clearance_height_to_rod");
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod);
Pointfs prev_exclude_areas = partplate_list.get_exclude_area();
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas);
if (new_shape) { if (new_shape) {
if (view3D) view3D->bed_shape_changed(); if (view3D) view3D->bed_shape_changed();
if (preview) preview->bed_shape_changed(); if (preview) preview->bed_shape_changed();

View File

@ -851,7 +851,7 @@ void TabPrinter::init_options_list()
for (const std::string& opt_key : m_config->keys()) for (const std::string& opt_key : m_config->keys())
{ {
if (opt_key == "printable_area") { if (opt_key == "printable_area" || opt_key == "bed_exclude_area") {
m_options_list.emplace(opt_key, m_opt_status_value); m_options_list.emplace(opt_key, m_opt_status_value);
continue; continue;
} }
@ -2677,7 +2677,9 @@ void TabPrinter::build_fff()
//create_line_with_widget(optgroup.get(), "printable_area", "custom-svg-and-png-bed-textures_124612", [this](wxWindow* parent) { //create_line_with_widget(optgroup.get(), "printable_area", "custom-svg-and-png-bed-textures_124612", [this](wxWindow* parent) {
// return create_bed_shape_widget(parent); // return create_bed_shape_widget(parent);
//}); //});
Option option = optgroup->get_option("bed_exclude_area");
option.opt.full_width = true;
optgroup->append_single_option_line(option);
optgroup->append_single_option_line("printable_height"); optgroup->append_single_option_line("printable_height");
optgroup->append_single_option_line("nozzle_volume"); optgroup->append_single_option_line("nozzle_volume");
// BBS // BBS
@ -2793,7 +2795,7 @@ void TabPrinter::build_fff()
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value); validate_custom_gcode_cb(this, optgroup, opt_key, value);
}; };
Option option = optgroup->get_option("machine_start_gcode"); option = optgroup->get_option("machine_start_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.is_code = true; option.opt.is_code = true;
option.opt.height = gcode_field_height;//150; option.opt.height = gcode_field_height;//150;