Skip to content

Commit

Permalink
Fix retraction calibration solid fill areas
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Feb 2, 2024
1 parent 981b77e commit 96cad10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/Extruder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ double Tool::extrude(double dE)
double Tool::retract(double length, std::optional<double> restart_extra, std::optional<double> restart_extra_toolchange)
{
assert(length < std::numeric_limits<int32_t>::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<int32_t>::max());
assert(!restart_extra || *restart_extra > -std::numeric_limits<int32_t>::max());
assert(!restart_extra_toolchange || *restart_extra_toolchange < std::numeric_limits<int32_t>::max());
Expand Down
11 changes: 8 additions & 3 deletions src/slic3r/GUI/CalibrationRetractionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModelObject*>> part_tower;
std::vector<std::string> 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));
Expand Down Expand Up @@ -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");
Expand All @@ -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<InfillPattern>(ipRectilinear));
Expand Down

0 comments on commit 96cad10

Please sign in to comment.