Calculation of wipe tower reduction corrected, new config option (wipe into infill)

This commit is contained in:
Lukas Matena 2018-05-25 16:11:55 +02:00
parent 132a67edb2
commit bfe4350a89
6 changed files with 56 additions and 36 deletions

View file

@ -1338,6 +1338,9 @@ void GCode::process_layer(
m_avoid_crossing_perimeters.disable_once = true; m_avoid_crossing_perimeters.disable_once = true;
} }
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
for (const auto& layer_to_print : layers) { // iterate through all objects for (const auto& layer_to_print : layers) { // iterate through all objects
if (layer_to_print.object_layer == nullptr) if (layer_to_print.object_layer == nullptr)
continue; continue;
@ -1358,6 +1361,8 @@ void GCode::process_layer(
gcode += this->extrude_infill(print, overridden); gcode += this->extrude_infill(print, overridden);
} }
} }
}
gcode += "; WIPING FINISHED\n";
auto objects_by_extruder_it = by_extruder.find(extruder_id); auto objects_by_extruder_it = by_extruder.find(extruder_id);

View file

@ -1142,17 +1142,19 @@ void Print::_make_wipe_tower()
// we run out of the volume (or infills) // we run out of the volume (or infills)
const float min_infill_volume = 0.f; const float min_infill_volume = 0.f;
if (config.filament_soluble.get_at(extruder_id)) // soluble filament cannot be wiped in a random infill
continue;
float volume_to_wipe = wipe_volumes[current_extruder_id][extruder_id]; float volume_to_wipe = wipe_volumes[current_extruder_id][extruder_id];
float saved_material = 0.f;
// soluble filament cannot be wiped in a random infill, first layer is potentionally visible too
if (!first_layer && !config.filament_soluble.get_at(extruder_id)) {
for (size_t i = 0; i < objects.size(); ++ i) { // Let's iterate through all objects... for (size_t i = 0; i < objects.size(); ++ i) { // Let's iterate through all objects...
for (Layer* lay : objects[i]->layers) { for (Layer* lay : objects[i]->layers) {
if (std::abs(layer_tools.print_z - lay->print_z) > EPSILON) continue;
for (LayerRegion* reg : lay->regions) { // and all regions for (LayerRegion* reg : lay->regions) { // and all regions
ExtrusionEntityCollection& eec = reg->fills; ExtrusionEntityCollection& eec = reg->fills;
for (ExtrusionEntity* ee : eec.entities) { // and all infill Collections for (ExtrusionEntity* ee : eec.entities) { // and all infill Collections
auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee); auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
if (fill->role() == erTopSolidInfill) continue;
if (volume_to_wipe > 0.f && !fill->is_extruder_overridden() && fill->total_volume() > min_infill_volume) { // this infill will be used to wipe this extruder if (volume_to_wipe > 0.f && !fill->is_extruder_overridden() && fill->total_volume() > min_infill_volume) { // this infill will be used to wipe this extruder
fill->set_extruder_override(extruder_id); fill->set_extruder_override(extruder_id);
volume_to_wipe -= fill->total_volume(); volume_to_wipe -= fill->total_volume();
@ -1161,9 +1163,10 @@ void Print::_make_wipe_tower()
} }
} }
} }
}
float saved_material = wipe_volumes[current_extruder_id][extruder_id] - std::max(0.f, volume_to_wipe); saved_material = wipe_volumes[current_extruder_id][extruder_id] - std::max(0.f, volume_to_wipe);
std::cout << volume_to_wipe << "\t(saved " << saved_material << ")" << std::endl; std::cout << layer_tools.print_z << "\t" << extruder_id << "\t" << wipe_volumes[current_extruder_id][extruder_id] - volume_to_wipe << "\n";
wipe_tower.plan_toolchange(layer_tools.print_z, layer_tools.wipe_tower_layer_height, current_extruder_id, extruder_id, first_layer && extruder_id == m_tool_ordering.all_extruders().back(), saved_material); wipe_tower.plan_toolchange(layer_tools.print_z, layer_tools.wipe_tower_layer_height, current_extruder_id, extruder_id, first_layer && extruder_id == m_tool_ordering.all_extruders().back(), saved_material);
current_extruder_id = extruder_id; current_extruder_id = extruder_id;

View file

@ -1885,6 +1885,14 @@ PrintConfigDef::PrintConfigDef()
def->cli = "wipe-tower-rotation-angle=f"; def->cli = "wipe-tower-rotation-angle=f";
def->default_value = new ConfigOptionFloat(0.); def->default_value = new ConfigOptionFloat(0.);
def = this->add("wipe_into_infill", coBool);
def->label = L("Wiping into infill");
def->tooltip = L("Wiping after toolchange will be preferentially done inside infills. "
"This lowers the amount of waste but may result in longer print time "
" due to additional travel moves.");
def->cli = "wipe-into-infill!";
def->default_value = new ConfigOptionBool(true);
def = this->add("wipe_tower_bridging", coFloat); def = this->add("wipe_tower_bridging", coFloat);
def->label = L("Maximal bridging distance"); def->label = L("Maximal bridging distance");
def->tooltip = L("Maximal distance between supports on sparse infill sections. "); def->tooltip = L("Maximal distance between supports on sparse infill sections. ");

View file

@ -642,6 +642,7 @@ public:
ConfigOptionFloat wipe_tower_per_color_wipe; ConfigOptionFloat wipe_tower_per_color_wipe;
ConfigOptionFloat wipe_tower_rotation_angle; ConfigOptionFloat wipe_tower_rotation_angle;
ConfigOptionFloat wipe_tower_bridging; ConfigOptionFloat wipe_tower_bridging;
ConfigOptionBool wipe_into_infill;
ConfigOptionFloats wiping_volumes_matrix; ConfigOptionFloats wiping_volumes_matrix;
ConfigOptionFloats wiping_volumes_extruders; ConfigOptionFloats wiping_volumes_extruders;
ConfigOptionFloat z_offset; ConfigOptionFloat z_offset;
@ -710,6 +711,7 @@ protected:
OPT_PTR(wipe_tower_width); OPT_PTR(wipe_tower_width);
OPT_PTR(wipe_tower_per_color_wipe); OPT_PTR(wipe_tower_per_color_wipe);
OPT_PTR(wipe_tower_rotation_angle); OPT_PTR(wipe_tower_rotation_angle);
OPT_PTR(wipe_into_infill);
OPT_PTR(wipe_tower_bridging); OPT_PTR(wipe_tower_bridging);
OPT_PTR(wiping_volumes_matrix); OPT_PTR(wiping_volumes_matrix);
OPT_PTR(wiping_volumes_extruders); OPT_PTR(wiping_volumes_extruders);

View file

@ -298,7 +298,8 @@ const std::vector<std::string>& Preset::print_options()
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width", "perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
"top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "bridge_flow_ratio", "clip_multipart_objects", "top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "bridge_flow_ratio", "clip_multipart_objects",
"elefant_foot_compensation", "xy_size_compensation", "threads", "resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y", "elefant_foot_compensation", "xy_size_compensation", "threads", "resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y",
"wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "compatible_printers", "compatible_printers_condition","inherits" "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "wipe_into_infill", "compatible_printers",
"compatible_printers_condition","inherits"
}; };
return s_opts; return s_opts;
} }

View file

@ -945,6 +945,7 @@ void TabPrint::build()
optgroup->append_single_option_line("wipe_tower_width"); optgroup->append_single_option_line("wipe_tower_width");
optgroup->append_single_option_line("wipe_tower_rotation_angle"); optgroup->append_single_option_line("wipe_tower_rotation_angle");
optgroup->append_single_option_line("wipe_tower_bridging"); optgroup->append_single_option_line("wipe_tower_bridging");
optgroup->append_single_option_line("wipe_into_infill");
optgroup = page->new_optgroup(_(L("Advanced"))); optgroup = page->new_optgroup(_(L("Advanced")));
optgroup->append_single_option_line("interface_shells"); optgroup->append_single_option_line("interface_shells");
@ -1233,7 +1234,7 @@ void TabPrint::update()
get_field("standby_temperature_delta")->toggle(have_ooze_prevention); get_field("standby_temperature_delta")->toggle(have_ooze_prevention);
bool have_wipe_tower = m_config->opt_bool("wipe_tower"); bool have_wipe_tower = m_config->opt_bool("wipe_tower");
for (auto el : { "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging"}) for (auto el : { "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_into_infill", "wipe_tower_bridging"})
get_field(el)->toggle(have_wipe_tower); get_field(el)->toggle(have_wipe_tower);
m_recommended_thin_wall_thickness_description_line->SetText( m_recommended_thin_wall_thickness_description_line->SetText(