diff options
author | Lukas Matena <lukasmatena@seznam.cz> | 2018-06-13 12:48:43 +0300 |
---|---|---|
committer | Lukas Matena <lukasmatena@seznam.cz> | 2018-06-13 12:48:43 +0300 |
commit | 29dd305aaa4b738eaef91bd2de82e667a17d89fa (patch) | |
tree | 8cfc878970f15da3936479da0c83d50013744ac9 /xs | |
parent | b6455b66bd7894b8d575ba91524aa93dc306888d (diff) |
Wiping into perimeters - bugfix (wrong order of perimeters and infills)
Diffstat (limited to 'xs')
-rw-r--r-- | xs/src/libslic3r/GCode.cpp | 17 | ||||
-rw-r--r-- | xs/src/libslic3r/Print.cpp | 21 |
2 files changed, 28 insertions, 10 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index ce63a374c..809745da2 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -1249,13 +1249,13 @@ void GCode::process_layer( // We just added perimeter_coll->entities.size() entities, if they are not to be printed before the main object (during infill wiping), // we will note their indices (for each copy separately): - unsigned int last_added_entity_index = islands[i].by_region[region_id].perimeters.entities.size()-1; + unsigned int first_added_entity_index = islands[i].by_region[region_id].perimeters.entities.size() - perimeter_coll->entities.size(); for (unsigned copy_id = 0; copy_id < layer_to_print.object()->_shifted_copies.size(); ++copy_id) { if (islands[i].by_region[region_id].perimeters_per_copy_ids.size() < copy_id + 1) // if this copy isn't in the list yet islands[i].by_region[region_id].perimeters_per_copy_ids.push_back(std::vector<unsigned int>()); if (!perimeter_coll->is_extruder_overridden(copy_id)) - for (int j=0; j<perimeter_coll->entities.size(); ++j) - islands[i].by_region[region_id].perimeters_per_copy_ids[copy_id].push_back(last_added_entity_index - j); + for (int j=first_added_entity_index; j<islands[i].by_region[region_id].perimeters.entities.size(); ++j) + islands[i].by_region[region_id].perimeters_per_copy_ids[copy_id].push_back(j); } break; } @@ -1292,13 +1292,13 @@ void GCode::process_layer( // We just added fill->entities.size() entities, if they are not to be printed before the main object (during infill wiping), // we will note their indices (for each copy separately): - unsigned int last_added_entity_index = islands[i].by_region[region_id].infills.entities.size()-1; + unsigned int first_added_entity_index = islands[i].by_region[region_id].infills.entities.size() - fill->entities.size(); for (unsigned copy_id = 0; copy_id < layer_to_print.object()->_shifted_copies.size(); ++copy_id) { if (islands[i].by_region[region_id].infills_per_copy_ids.size() < copy_id + 1) // if this copy isn't in the list yet islands[i].by_region[region_id].infills_per_copy_ids.push_back(std::vector<unsigned int>()); if (!fill->is_extruder_overridden(copy_id)) - for (int j=0; j<fill->entities.size(); ++j) - islands[i].by_region[region_id].infills_per_copy_ids[copy_id].push_back(last_added_entity_index - j); + for (int j=first_added_entity_index; j<islands[i].by_region[region_id].infills.entities.size(); ++j) + islands[i].by_region[region_id].infills_per_copy_ids[copy_id].push_back(j); } break; } @@ -1357,6 +1357,7 @@ void GCode::process_layer( m_avoid_crossing_perimeters.disable_once = true; } + if (layer_tools.has_wipe_tower) // the infill/perimeter wiping to save the material on the wipe tower { gcode += "; INFILL WIPING STARTS\n"; if (extruder_id != layer_tools.extruders.front()) { // if this is the first extruder on this layer, there was no toolchange @@ -2511,7 +2512,7 @@ Point GCode::gcode_to_point(const Pointf &point) const } -// Goes through by_region std::vector and returns ref a subvector of entities to be printed in usual time +// Goes through by_region std::vector and returns reference to a subvector of entities to be printed in usual time // i.e. not when it's going to be done during infill wiping const std::vector<GCode::ObjectByExtruder::Island::Region>& GCode::ObjectByExtruder::Island::by_region_per_copy(unsigned int copy) { @@ -2522,10 +2523,8 @@ const std::vector<GCode::ObjectByExtruder::Island::Region>& GCode::ObjectByExtru last_copy = copy; } - //std::vector<ObjectByExtruder::Island::Region> out; for (const auto& reg : by_region) { by_region_per_copy_cache.push_back(ObjectByExtruder::Island::Region()); - //out.back().perimeters.append(reg.perimeters); // we will print all perimeters there are if (!reg.infills_per_copy_ids.empty()) for (unsigned int i=0; i<reg.infills_per_copy_ids[copy].size(); ++i) diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 5664bd5b1..d448ab2f3 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -206,7 +206,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option || opt_key == "wipe_tower_rotation_angle" || opt_key == "wipe_tower_bridging" || opt_key == "wiping_volumes_matrix" - || opt_key == u8"parking_pos_retraction" + || opt_key == "parking_pos_retraction" || opt_key == "cooling_tube_retraction" || opt_key == "cooling_tube_length" || opt_key == "extra_loading_move" @@ -1196,6 +1196,25 @@ void Print::reset_wiping_extrusions() { +// Strategy for wiping (TODO): +// if !infill_first +// start with dedicated objects +// print a perimeter and its corresponding infill immediately after +// repeat until there are no dedicated objects left +// if there are some left and this is the last toolchange on the layer, mark all remaining extrusions of the object (so we don't have to travel back to it later) +// move to normal objects +// start with one object and start assigning its infill, if their perimeters ARE ALREADY EXTRUDED +// never touch perimeters +// +// if infill first +// start with dedicated objects +// print an infill and its corresponding perimeter immediately after +// repeat until you run out of infills +// move to normal objects +// start assigning infills (one copy after another) +// repeat until you run out of infills, leave perimeters be + + float Print::mark_wiping_extrusions(const ToolOrdering::LayerTools& layer_tools, unsigned int new_extruder, float volume_to_wipe) { const float min_infill_volume = 0.f; // ignore infill with smaller volume than this |