disbale / use editable function of wxcombobox for calibrations

supermerill/SuperSlicer#1228
This commit is contained in:
remi durand 2021-06-02 17:17:30 +02:00
parent 4688d962b6
commit 35d23d57ec
4 changed files with 40 additions and 26 deletions

View File

@ -62,10 +62,14 @@ void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool
gui_app->app_config->set("autocenter", "0"); gui_app->app_config->set("autocenter", "0");
} }
int idx_steps = steps->GetSelection(); long step = 10;
int idx_nb = nb_tests->GetSelection(); if (!steps->GetValue().ToLong(&step)) {
size_t step = 5 + (idx_steps == wxNOT_FOUND ? 0 : idx_steps * 5); step = 10;
size_t nb_items = 1 + (idx_nb == wxNOT_FOUND ? 0 : idx_nb); }
long nb_items = 10;
if (!nb_tests->GetValue().ToLong(&nb_items)) {
nb_items = 10;
}
std::vector<std::string> items; std::vector<std::string> items;
for (size_t i = 0; i < nb_items; i++) for (size_t i = 0; i < nb_items; i++)

View File

@ -24,17 +24,19 @@ namespace Slic3r {
namespace GUI { namespace GUI {
void CalibrationCubeDialog::create_buttons(wxStdDialogButtonSizer* buttons){ void CalibrationCubeDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxString choices_scale[] = { "10mm", "20mm", "30mm", "40mm" }; wxString choices_scale[] = { "10", "20", "30", "40" };
scale = new wxComboBox(this, wxID_ANY, wxString{ "20mm" }, wxDefaultPosition, wxDefaultSize, 4, choices_scale); scale = new wxComboBox(this, wxID_ANY, wxString{ "20" }, wxDefaultPosition, wxDefaultSize, 4, choices_scale);
scale->SetToolTip(_(L("You can choose the dimension of the cube. It's a simple scale, you can modify it in the right panel yourself if you prefer. It's just quicker to select it here."))); scale->SetToolTip(_(L("You can choose the dimension of the cube. It's a simple scale, you can modify it in the right panel yourself if you prefer. It's just quicker to select it here.")));
scale->SetSelection(1); scale->SetSelection(1);
wxString choices_goal[] = { "Dimensional accuracy (default)" , "infill/perimeter overlap"/*, "external perimeter overlap"*/}; wxString choices_goal[] = { "Dimensional accuracy (default)" , "infill/perimeter overlap"/*, "external perimeter overlap"*/};
calibrate = new wxComboBox(this, wxID_ANY, wxString{ "Dimensional accuracy (default)" }, wxDefaultPosition, wxDefaultSize, 2, choices_goal); calibrate = new wxComboBox(this, wxID_ANY, wxString{ "Dimensional accuracy (default)" }, wxDefaultPosition, wxDefaultSize, 2, choices_goal);
calibrate->SetToolTip(_(L("Select a goal, this will change settings to increase the effects to search."))); calibrate->SetToolTip(_(L("Select a goal, this will change settings to increase the effects to search.")));
calibrate->SetSelection(0); calibrate->SetSelection(0);
calibrate->SetEditable(false);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "dimension:" })); buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "dimension:" }));
buttons->Add(scale); buttons->Add(scale);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "mm" }));
buttons->AddSpacer(40); buttons->AddSpacer(40);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "goal:" })); buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "goal:" }));
buttons->Add(calibrate); buttons->Add(calibrate);
@ -74,7 +76,11 @@ void CalibrationCubeDialog::create_geometry(std::string calibration_path) {
if (calibration_path == "xyzCalibration_cube.amf") if (calibration_path == "xyzCalibration_cube.amf")
cube_size = 20; cube_size = 20;
int idx_scale = scale->GetSelection(); int idx_scale = scale->GetSelection();
float xyzScale = (10/cube_size) * (idx_scale+1); double xyzScale = 20;
if (!scale->GetValue().ToDouble(&xyzScale)) {
xyzScale = 20;
}
xyzScale = xyzScale / cube_size;
//do scaling //do scaling
model.objects[objs_idx[0]]->scale(xyzScale, xyzScale, xyzScale); model.objects[objs_idx[0]]->scale(xyzScale, xyzScale, xyzScale);

View File

@ -26,8 +26,8 @@ namespace Slic3r {
namespace GUI { namespace GUI {
void CalibrationRetractionDialog::create_buttons(wxStdDialogButtonSizer* buttons){ void CalibrationRetractionDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxString choices_steps[] = { "0.1","0.2","0.5","1" }; wxString choices_steps[] = { "0.1","0.2","0.5","1","2" };
steps = new wxComboBox(this, wxID_ANY, wxString{ "0.2" }, wxDefaultPosition, wxDefaultSize, 4, choices_steps); steps = new wxComboBox(this, wxID_ANY, wxString{ "0.2" }, wxDefaultPosition, wxDefaultSize, 5, choices_steps);
steps->SetToolTip(_L("Each militer add this value to the retraction value. ")); steps->SetToolTip(_L("Each militer add this value to the retraction value. "));
steps->SetSelection(1); steps->SetSelection(1);
wxString choices_nb[] = { "2","4","6","8","10","15","20","25" }; wxString choices_nb[] = { "2","4","6","8","10","15","20","25" };
@ -47,6 +47,7 @@ void CalibrationRetractionDialog::create_buttons(wxStdDialogButtonSizer* buttons
decr_temp = new wxComboBox(this, wxID_ANY, wxString{ "current" }, wxDefaultPosition, wxDefaultSize, 6, choices_decr); decr_temp = new wxComboBox(this, wxID_ANY, wxString{ "current" }, wxDefaultPosition, wxDefaultSize, 6, choices_decr);
decr_temp->SetToolTip(_L("Select the number tower to print, and by how many degrees C to decrease each time.")); decr_temp->SetToolTip(_L("Select the number tower to print, and by how many degrees C to decrease each time."));
decr_temp->SetSelection(0); decr_temp->SetSelection(0);
decr_temp->SetEditable(false);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "step:" })); buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "step:" }));
buttons->Add(steps); buttons->Add(steps);
@ -109,7 +110,10 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
gui_app->app_config->set("autocenter", "0"); gui_app->app_config->set("autocenter", "0");
} }
size_t nb_retract = nb_steps->GetSelection() < 4 ? ((int(nb_steps->GetSelection()) + 1) * 2) : ((int(nb_steps->GetSelection()) - 2) * 5); long nb_retract = 1;
if (!nb_steps->GetValue().ToLong(&nb_retract)) {
nb_retract = 15;
}
size_t nb_items = 1; size_t nb_items = 1;
if (decr_temp->GetSelection() == 1) { if (decr_temp->GetSelection() == 1) {
nb_items = 2; nb_items = 2;
@ -141,16 +145,9 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
temp = std::atoi(str.c_str()); temp = std::atoi(str.c_str());
double retraction_steps = 0.01; double retraction_steps = 0.01;
if (steps->GetSelection() == 0) if (!steps->GetValue().ToDouble(&retraction_steps)) {
retraction_steps = 0.1; retraction_steps = 0.1;
if (steps->GetSelection() == 1) }
retraction_steps = 0.2;
if (steps->GetSelection() == 2)
retraction_steps = 0.5;
if (steps->GetSelection() == 3)
retraction_steps = 1;
if (steps->GetSelection() == 4)
retraction_steps = 2;
/// --- scale --- /// --- scale ---
// model is created for a 0.4 nozzle, scale xy with nozzle size. // model is created for a 0.4 nozzle, scale xy with nozzle size.

View File

@ -70,15 +70,22 @@ void CalibrationTempDialog::create_geometry(wxCommandEvent& event_args) {
// -- get temps // -- get temps
const ConfigOptionInts* temperature_config = filament_config->option<ConfigOptionInts>("temperature"); const ConfigOptionInts* temperature_config = filament_config->option<ConfigOptionInts>("temperature");
assert(temperature_config->values.size() >= 1); assert(temperature_config->values.size() >= 1);
int idx_steps = steps->GetSelection(); long nb_items_up = 1;
int idx_up = nb_up->GetSelection(); if (!nb_up->GetValue().ToLong(&nb_items_up)) {
int idx_down = nb_down->GetSelection(); nb_items_up = 2;
}
long nb_items_down = 1;
if (!nb_down->GetValue().ToLong(&nb_items_down)) {
nb_items_down = 2;
}
int16_t temperature = 5 * (temperature_config->values[0] / 5); int16_t temperature = 5 * (temperature_config->values[0] / 5);
size_t step_temp = 5 + (idx_steps == wxNOT_FOUND ? 0 : (idx_steps * 5)); long step_temp = 1;
size_t nb_items = 1 + (idx_down == wxNOT_FOUND ? 0 : idx_down) if (!steps->GetValue().ToLong(&step_temp)) {
+ (idx_up == wxNOT_FOUND ? 0 : idx_up); step_temp = 10;
}
size_t nb_items = 1 + nb_items_up + nb_items_down;
//start at the highest temp //start at the highest temp
temperature = temperature + step_temp * (idx_up == wxNOT_FOUND ? 0 : idx_up); temperature = temperature + step_temp * nb_items_up;
/// --- scale --- /// --- scale ---
//model is created for a 0.4 nozzle, scale xy with nozzle size. //model is created for a 0.4 nozzle, scale xy with nozzle size.