From 96cad10df73f87be337f2c45f79aecb31c598730 Mon Sep 17 00:00:00 2001 From: supermerill Date: Wed, 31 Jan 2024 15:44:15 +0100 Subject: [PATCH] Fix retraction calibration solid fill areas supermerill/SuperSlicer#4097 --- src/libslic3r/Extruder.cpp | 2 +- src/slic3r/GUI/CalibrationRetractionDialog.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/Extruder.cpp b/src/libslic3r/Extruder.cpp index ca156d5b8f5..e12a5cd0b36 100644 --- a/src/libslic3r/Extruder.cpp +++ b/src/libslic3r/Extruder.cpp @@ -53,7 +53,7 @@ double Tool::extrude(double dE) double Tool::retract(double length, std::optional restart_extra, std::optional restart_extra_toolchange) { assert(length < std::numeric_limits::max()); - assert(length > 0); + //assert(length > 0); // it's possible, as you may want to "reset the extruder but do not use restart_extra yet. assert(!restart_extra || *restart_extra < std::numeric_limits::max()); assert(!restart_extra || *restart_extra > -std::numeric_limits::max()); assert(!restart_extra_toolchange || *restart_extra_toolchange < std::numeric_limits::max()); diff --git a/src/slic3r/GUI/CalibrationRetractionDialog.cpp b/src/slic3r/GUI/CalibrationRetractionDialog.cpp index 3f9dd45eae4..edd3b598b37 100644 --- a/src/slic3r/GUI/CalibrationRetractionDialog.cpp +++ b/src/slic3r/GUI/CalibrationRetractionDialog.cpp @@ -177,11 +177,13 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) { //add sub-part after scale float zscale_number = (first_layer_height + layer_height) / 0.4; std::vector < std::vector> part_tower; + std::vector filament_temp_item_name; 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 >= 180 && mytemp % 5 == 0) { - add_part(model.objects[objs_idx[id_item]], (boost::filesystem::path(Slic3r::resources_dir()) / "calibration" / "filament_temp" / ("t" + std::to_string(mytemp) + ".amf")).string(), + filament_temp_item_name.push_back("t" + std::to_string(mytemp) + ".amf"); + add_part(model.objects[objs_idx[id_item]], (boost::filesystem::path(Slic3r::resources_dir()) / "calibration" / "filament_temp" / filament_temp_item_name.back()).string(), Vec3d{ 0,0, scale * 0.0 - 4.8 }, 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)); @@ -209,6 +211,8 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) { /// --- custom config --- + assert(filament_temp_item_name.size() == nb_items); + assert(model.objects.size() == nb_items); for (size_t i = 0; i < nb_items; i++) { //speed double perimeter_speed = full_print_config.get_computed_value("perimeter_speed"); @@ -218,8 +222,9 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) { model.objects[objs_idx[i]]->config.set_key_value("perimeters", new ConfigOptionInt(2)); model.objects[objs_idx[i]]->config.set_key_value("external_perimeters_first", new ConfigOptionBool(false)); model.objects[objs_idx[i]]->config.set_key_value("bottom_solid_layers", new ConfigOptionInt(0)); - model.objects[objs_idx[i]]->volumes[0]->config.set_key_value("bottom_solid_layers", new ConfigOptionInt(2)); - //model.objects[objs_idx[i]]->volumes[1]->config.set_key_value("bottom_solid_layers", new ConfigOptionInt(2)); + for(auto& volume : model.objects[objs_idx[i]]->volumes) + if( volume->name == filament_temp_item_name[i] || volume->name.empty()) // if temperature patch or the main retraction patch (empty name because it's the initial volume) + volume->config.set_key_value("bottom_solid_layers", new ConfigOptionInt(2)); model.objects[objs_idx[i]]->config.set_key_value("top_solid_layers", new ConfigOptionInt(0)); model.objects[objs_idx[i]]->config.set_key_value("fill_density", new ConfigOptionPercent(0)); //model.objects[objs_idx[i]]->config.set_key_value("fill_pattern", new ConfigOptionEnum(ipRectilinear));