|
@@ -27,17 +27,21 @@ void CalibrationRetractionDialog::create_buttons(wxStdDialogButtonSizer* buttons
|
|
|
steps->SetToolTip(_(L("Each militer add this value to the retraction value. ")));
|
|
|
steps->SetSelection(1);
|
|
|
wxString choices_nb[] = { "2","4","6","8","10","15","20","25" };
|
|
|
- nb_steps = new wxComboBox(this, wxID_ANY, wxString{ "10" }, wxDefaultPosition, wxDefaultSize, 8, choices_nb);
|
|
|
+ nb_steps = new wxComboBox(this, wxID_ANY, wxString{ "15" }, wxDefaultPosition, wxDefaultSize, 8, choices_nb);
|
|
|
nb_steps->SetToolTip(_(L("Select the number milimeters for the tower.")));
|
|
|
- nb_steps->SetSelection(4);
|
|
|
+ nb_steps->SetSelection(5);
|
|
|
//wxString choices_start[] = { "current","260","250","240","230","220","210" };
|
|
|
//start_step = new wxComboBox(this, wxID_ANY, wxString{ "current" }, wxDefaultPosition, wxDefaultSize, 7, choices_start);
|
|
|
//start_step->SetToolTip(_(L("Select the highest temperature to test for.")));
|
|
|
//start_step->SetSelection(0);
|
|
|
- //wxString choices_decr[] = { "one test","2x10°","3x10°","4x10°","3x5°","5x5°" };
|
|
|
- //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->SetSelection(0);
|
|
|
+ const DynamicPrintConfig* filament_config = this->gui_app->get_tab(Preset::TYPE_FILAMENT)->get_config();
|
|
|
+ int temp = int((2 + filament_config->option<ConfigOptionInts>("temperature")->get_at(0)) / 5) * 5;
|
|
|
+ auto size = wxSize(4 * em_unit(), wxDefaultCoord);
|
|
|
+ temp_start = new wxTextCtrl(this, wxID_ANY, std::to_string(temp), wxDefaultPosition, size);
|
|
|
+ wxString choices_decr[] = { "one test","2x10°","3x10°","4x10°","3x5°","5x5°" };
|
|
|
+ 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->SetSelection(0);
|
|
|
|
|
|
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "step:" }));
|
|
|
buttons->Add(steps);
|
|
@@ -46,12 +50,12 @@ void CalibrationRetractionDialog::create_buttons(wxStdDialogButtonSizer* buttons
|
|
|
buttons->Add(nb_steps);
|
|
|
buttons->AddSpacer(20);
|
|
|
|
|
|
- //buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "start temp:" }));
|
|
|
- //buttons->Add(start_step);
|
|
|
- //buttons->AddSpacer(15);
|
|
|
- //buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "temp decr:" }));
|
|
|
- //buttons->Add(decr_temp);
|
|
|
- //buttons->AddSpacer(20);
|
|
|
+ buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "start temp:" }));
|
|
|
+ buttons->Add(temp_start);
|
|
|
+ buttons->AddSpacer(15);
|
|
|
+ buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "temp decr:" }));
|
|
|
+ buttons->Add(decr_temp);
|
|
|
+ buttons->AddSpacer(20);
|
|
|
|
|
|
wxButton* bt = new wxButton(this, wxID_FILE1, _(L("Remove fil. slowdown")));
|
|
|
bt->Bind(wxEVT_BUTTON, &CalibrationRetractionDialog::remove_slowdown, this);
|
|
@@ -95,18 +99,20 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
|
|
|
|
|
|
size_t nb_retract = nb_steps->GetSelection() < 4 ? ((int(nb_steps->GetSelection()) + 1) * 2) : ((int(nb_steps->GetSelection()) - 2) * 5);
|
|
|
size_t nb_items = 1;
|
|
|
- //if (start_step->GetSelection() == 1) {
|
|
|
- // nb_items = 2;
|
|
|
- //} else if (start_step->GetSelection() == 2 || start_step->GetSelection() == 4) {
|
|
|
- // nb_items = 3;
|
|
|
- //} else if (start_step->GetSelection() == 3) {
|
|
|
- // nb_items = 4;
|
|
|
- //} else if (start_step->GetSelection() == 5) {
|
|
|
- // nb_items = 5;
|
|
|
- //}
|
|
|
-
|
|
|
+ if (decr_temp->GetSelection() == 1) {
|
|
|
+ nb_items = 2;
|
|
|
+ } else if (decr_temp->GetSelection() == 2 || decr_temp->GetSelection() == 4) {
|
|
|
+ nb_items = 3;
|
|
|
+ } else if (decr_temp->GetSelection() == 3) {
|
|
|
+ nb_items = 4;
|
|
|
+ } else if (decr_temp->GetSelection() == 5) {
|
|
|
+ nb_items = 5;
|
|
|
+ }
|
|
|
+ int temp_decr = (decr_temp->GetSelection() < 4) ? 10 : 5;
|
|
|
+
|
|
|
|
|
|
std::vector<std::string> items;
|
|
|
+ for (size_t i = 0; i < nb_items; i++)
|
|
|
items.emplace_back(Slic3r::resources_dir() + "/calibration/retraction/retraction_calibration.amf");
|
|
|
std::vector<size_t> objs_idx = plat->load_files(items, true, false, false);
|
|
|
|
|
@@ -115,9 +121,12 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
|
|
|
const DynamicPrintConfig* print_config = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config();
|
|
|
const DynamicPrintConfig* printer_config = this->gui_app->get_tab(Preset::TYPE_PRINTER)->get_config();
|
|
|
const DynamicPrintConfig* filament_config = this->gui_app->get_tab(Preset::TYPE_FILAMENT)->get_config();
|
|
|
-
|
|
|
+
|
|
|
double retraction_start = 0;
|
|
|
- int temp = filament_config->option<ConfigOptionInts>("temperature")->get_at(0);
|
|
|
+ std::string str = temp_start->GetValue().ToStdString();
|
|
|
+ int temp = int((2 + filament_config->option<ConfigOptionInts>("temperature")->get_at(0)) / 5) * 5;
|
|
|
+ if (str.find_first_not_of("0123456789") == std::string::npos)
|
|
|
+ temp = std::atoi(str.c_str());
|
|
|
|
|
|
double retraction_steps = 0.01;
|
|
|
if (steps->GetSelection() == 0)
|
|
@@ -154,12 +163,18 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
|
|
|
//add sub-part after scale
|
|
|
float zshift = (1 - scale) / 2 + 0.4 * scale;
|
|
|
float zscale_number = (first_layer_height + layer_height) / 0.4;
|
|
|
- std::vector<ModelObject*> part_tower;
|
|
|
- //add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/t215.amf", Vec3d{ 0,0,zshift-5.2*scale }, Vec3d{ scale,scale,scale });
|
|
|
- //model.objects[objs_idx[0]]->volumes[1]->rotate(PI/2, Vec3d(0, 0, 1));
|
|
|
- //model.objects[objs_idx[0]]->volumes[1]->rotate(-PI / 2, Vec3d(1, 0, 0));
|
|
|
- for (size_t num_retract = 0; num_retract < nb_retract; num_retract++) {
|
|
|
- part_tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/retraction/retraction_calibration_pillar.amf", Vec3d{ 0,0,zshift + scale * num_retract }, Vec3d{ scale,scale,scale }));
|
|
|
+ std::vector < std::vector<ModelObject*>> part_tower;
|
|
|
+ for (size_t id_item = 0; id_item < nb_items; id_item++) {
|
|
|
+ part_tower.emplace_back();
|
|
|
+ int mytemp = temp - temp_decr * id_item;
|
|
|
+ if (mytemp > 285) mytemp = 285;
|
|
|
+ if (mytemp < 180) mytemp = 180;
|
|
|
+ add_part(model.objects[objs_idx[id_item]], Slic3r::resources_dir() + "/calibration/filament_temp/t"+ std::to_string(mytemp) + ".amf", Vec3d{ 0,0,zshift - 5.2 * scale }, Vec3d{ scale,scale,scale });
|
|
|
+ model.objects[objs_idx[id_item]]->volumes[1]->rotate(PI / 2, Vec3d(0, 0, 1));
|
|
|
+ model.objects[objs_idx[id_item]]->volumes[1]->rotate(-PI / 2, Vec3d(1, 0, 0));
|
|
|
+ for (int num_retract = 0; num_retract < nb_retract; num_retract++) {
|
|
|
+ part_tower.back().push_back(add_part(model.objects[objs_idx[id_item]], Slic3r::resources_dir() + "/calibration/retraction/retraction_calibration_pillar.amf", Vec3d{ 0,0,zshift + scale * num_retract }, Vec3d{ scale,scale,scale }));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// --- translate ---;
|
|
@@ -168,8 +183,14 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
|
|
|
const float brim_width = std::max(print_config->option<ConfigOptionFloat>("brim_width")->value, nozzle_diameter * 5.);
|
|
|
Vec2d bed_size = BoundingBoxf(bed_shape->values).size();
|
|
|
Vec2d bed_min = BoundingBoxf(bed_shape->values).min;
|
|
|
- float offsety = 2 + 22 * 1 + extruder_clearance_radius->value + brim_width + (brim_width > extruder_clearance_radius->value ? brim_width - extruder_clearance_radius->value : 0);
|
|
|
- model.objects[objs_idx[0]]->translate({ bed_min.x() + bed_size.x() / 2, bed_min.y() + bed_size.y() / 2, 0 });
|
|
|
+ float offset = 4 + 26 * 1 + extruder_clearance_radius->value + brim_width + (brim_width > extruder_clearance_radius->value ? brim_width - extruder_clearance_radius->value : 0);
|
|
|
+ if (nb_items == 1) {
|
|
|
+ model.objects[objs_idx[0]]->translate({ bed_min.x() + bed_size.x() / 2, bed_min.y() + bed_size.y() / 2, 0 });
|
|
|
+ } else {
|
|
|
+ for (size_t i = 0; i < nb_items; i++) {
|
|
|
+ model.objects[objs_idx[i]]->translate({ bed_min.x() + bed_size.x() / 2 + (i%2 ==0 ? -offset/2: offset/2), bed_min.y() + bed_size.y() / 2 + ( (i/2) % 2 == 0 ? -1 : 1) * offset * (((i / 2) + 1) / 2), 0 });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -178,18 +199,6 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
|
|
|
//speed
|
|
|
double perimeter_speed = print_config->option<ConfigOptionFloat>("perimeter_speed")->value;
|
|
|
double external_perimeter_speed = print_config->option<ConfigOptionFloatOrPercent>("external_perimeter_speed")->get_abs_value(perimeter_speed);
|
|
|
- //filament test
|
|
|
- //const ConfigOptionInts* fil_conf = filament_config->option<ConfigOptionInts>("slowdown_below_layer_time");
|
|
|
- //ConfigOptionInts* new_fil_conf = new ConfigOptionInts();
|
|
|
- //new_fil_conf->default_value = 5;
|
|
|
- //new_fil_conf->values = fil_conf->values;
|
|
|
- //new_fil_conf->values[0] = 0;
|
|
|
- //model.objects[objs_idx[i]]->config.set_key_value("slowdown_below_layer_time", new_fil_conf);
|
|
|
- //fil_conf = filament_config->option<ConfigOptionInts>("temperature");
|
|
|
- //new_fil_conf = new ConfigOptionInts();
|
|
|
- //new_fil_conf->values = fil_conf->values;
|
|
|
- //new_fil_conf->values[0] = 150;
|
|
|
- //model.objects[objs_idx[i]]->config.set_key_value("temperature", new_fil_conf);
|
|
|
//brim to have some time to build up pressure in the nozzle
|
|
|
model.objects[objs_idx[i]]->config.set_key_value("brim_width", new ConfigOptionFloat(0));
|
|
|
model.objects[objs_idx[i]]->config.set_key_value("perimeters", new ConfigOptionInt(2));
|
|
@@ -207,14 +216,16 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
|
|
|
model.objects[objs_idx[i]]->config.set_key_value("gap_fill", new ConfigOptionBool(false));
|
|
|
model.objects[objs_idx[i]]->config.set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(nozzle_diameter / 2., false));
|
|
|
model.objects[objs_idx[i]]->config.set_key_value("layer_height", new ConfigOptionFloat(nozzle_diameter / 2.));
|
|
|
+ //temp
|
|
|
+ model.objects[objs_idx[i]]->config.set_key_value("print_temperature", new ConfigOptionInt(int(temp - temp_decr * i)));
|
|
|
//set retraction override
|
|
|
- int num_part = 0;
|
|
|
- for (ModelObject* part : part_tower) {
|
|
|
- model.objects[objs_idx[i]]->volumes[num_part + 1]->config.set_key_value("print_retract_length", new ConfigOptionFloat(retraction_start + num_part * retraction_steps));
|
|
|
- model.objects[objs_idx[i]]->volumes[num_part + 1]->config.set_key_value("small_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false));
|
|
|
- model.objects[objs_idx[i]]->volumes[num_part + 1]->config.set_key_value("perimeter_speed", new ConfigOptionFloat(std::min(external_perimeter_speed, perimeter_speed)));
|
|
|
- model.objects[objs_idx[i]]->volumes[num_part + 1]->config.set_key_value("external_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false));
|
|
|
- model.objects[objs_idx[i]]->volumes[num_part + 1]->config.set_key_value("small_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false));
|
|
|
+ size_t num_part = 0;
|
|
|
+ for (ModelObject* part : part_tower[i]) {
|
|
|
+ model.objects[objs_idx[i]]->volumes[num_part + 2]->config.set_key_value("print_retract_length", new ConfigOptionFloat(retraction_start + num_part * retraction_steps));
|
|
|
+ model.objects[objs_idx[i]]->volumes[num_part + 2]->config.set_key_value("small_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false));
|
|
|
+ model.objects[objs_idx[i]]->volumes[num_part + 2]->config.set_key_value("perimeter_speed", new ConfigOptionFloat(std::min(external_perimeter_speed, perimeter_speed)));
|
|
|
+ model.objects[objs_idx[i]]->volumes[num_part + 2]->config.set_key_value("external_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false));
|
|
|
+ model.objects[objs_idx[i]]->volumes[num_part + 2]->config.set_key_value("small_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false));
|
|
|
//model.objects[objs_idx[i]]->volumes[num_part + 1]->config.set_key_value("infill_speed", new ConfigOptionFloat(std::min(print_config->option<ConfigOptionFloat>("infill_speed")->value, 10.*scale)));
|
|
|
num_part++;
|
|
|
}
|