mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 06:18:59 +08:00
Ramming lines that would end unsupported are made longer to reach to the edge
This commit is contained in:
parent
e1922cb2c5
commit
76aa134f66
@ -800,6 +800,46 @@ void WipeTowerPrusaMM::toolchange_Unload(
|
|||||||
|
|
||||||
writer.travel(xl, cleaning_box.ld.y + m_depth_traversed + y_step/2.f ); // move to starting position
|
writer.travel(xl, cleaning_box.ld.y + m_depth_traversed + y_step/2.f ); // move to starting position
|
||||||
|
|
||||||
|
// if the ending point of the ram would end up in mid air, align it with the end of the wipe tower:
|
||||||
|
if (m_layer_info > m_plan.begin() && m_layer_info < m_plan.end()) {
|
||||||
|
|
||||||
|
// this is y of the center of first supported line
|
||||||
|
float sparse_beginning_y = m_wipe_tower_pos.y
|
||||||
|
+ ((m_layer_info-1)->depth - (m_layer_info-1)->toolchanges_depth());
|
||||||
|
|
||||||
|
//debugging:
|
||||||
|
/* float oldx = writer.x();
|
||||||
|
float oldy = writer.y();
|
||||||
|
writer.travel(xr,sparse_beginning_y);
|
||||||
|
writer.extrude(xr+5,writer.y());
|
||||||
|
writer.travel(oldx,oldy);*/
|
||||||
|
|
||||||
|
float sum_of_depths = 0.f;
|
||||||
|
for (const auto& tch : m_layer_info->tool_changes) { // let's find this toolchange
|
||||||
|
if (tch.old_tool == m_current_tool) {
|
||||||
|
sum_of_depths += tch.ramming_depth;
|
||||||
|
float ramming_end_y = m_wipe_tower_pos.y + sum_of_depths;
|
||||||
|
ramming_end_y -= (y_step/m_extra_spacing-m_line_width) / 2.f; // center of final ramming line
|
||||||
|
|
||||||
|
// debugging:
|
||||||
|
/*float oldx = writer.x();
|
||||||
|
float oldy = writer.y();
|
||||||
|
writer.travel(xl,ramming_end_y);
|
||||||
|
writer.extrude(xl-15,writer.y());
|
||||||
|
writer.travel(oldx,oldy);*/
|
||||||
|
|
||||||
|
if (ramming_end_y < sparse_beginning_y) {
|
||||||
|
writer.extrude(xl + tch.first_wipe_line-1.f*m_perimeter_width-0.1f,writer.y());
|
||||||
|
writer.travel(xl + tch.first_wipe_line-1.f*m_perimeter_width,writer.y());
|
||||||
|
remaining -= tch.first_wipe_line-1.f*m_perimeter_width;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sum_of_depths += tch.required_depth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// now the ramming itself:
|
||||||
while (i < m_par.ramming_speed[m_current_tool].size())
|
while (i < m_par.ramming_speed[m_current_tool].size())
|
||||||
{
|
{
|
||||||
const float x = volume_to_length(m_par.ramming_speed[m_current_tool][i] * 0.25f, line_width, m_layer_height);
|
const float x = volume_to_length(m_par.ramming_speed[m_current_tool][i] * 0.25f, line_width, m_layer_height);
|
||||||
@ -1031,14 +1071,22 @@ void WipeTowerPrusaMM::toolchange_Wipe(
|
|||||||
const float& xl = cleaning_box.ld.x;
|
const float& xl = cleaning_box.ld.x;
|
||||||
const float& xr = cleaning_box.rd.x;
|
const float& xr = cleaning_box.rd.x;
|
||||||
|
|
||||||
// DEBUGGING: The function makes sure it always wipes at least the ordered volume, even if it means violating
|
|
||||||
// the perimeter. This can later be removed and simply wipe until the end of the assigned area.
|
// Variables x_to_wipe and traversed_x are here to be able to make sure it always wipes at least
|
||||||
// (Variables x_to_wipe and traversed_x)
|
// the ordered volume, even if it means violating the box. This can later be removed and simply
|
||||||
|
// wipe until the end of the assigned area.
|
||||||
|
|
||||||
float x_to_wipe = volume_to_length(wipe_volume, m_line_width, m_layer_height);
|
float x_to_wipe = volume_to_length(wipe_volume, m_line_width, m_layer_height);
|
||||||
float dy = m_extra_spacing*m_line_width;
|
float dy = m_extra_spacing*m_line_width;
|
||||||
float wipe_speed = 1600.f;
|
float wipe_speed = 1600.f;
|
||||||
|
|
||||||
|
// if there is less than 2.5*m_perimeter_width to the edge, advance straightaway (there is likely a blob anyway)
|
||||||
|
if ((m_left_to_right ? xr-writer.x() : writer.x()-xl) < 2.5f*m_perimeter_width) {
|
||||||
|
writer.travel((m_left_to_right ? xr-m_perimeter_width : xl+m_perimeter_width),writer.y()+dy);
|
||||||
|
m_left_to_right = !m_left_to_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
// now the wiping itself:
|
||||||
for (int i = 0; true; ++i) {
|
for (int i = 0; true; ++i) {
|
||||||
if (i!=0) {
|
if (i!=0) {
|
||||||
if (wipe_speed < 1610.f) wipe_speed = 1800.f;
|
if (wipe_speed < 1610.f) wipe_speed = 1800.f;
|
||||||
@ -1067,9 +1115,6 @@ void WipeTowerPrusaMM::toolchange_Wipe(
|
|||||||
m_left_to_right = !m_left_to_right;
|
m_left_to_right = !m_left_to_right;
|
||||||
}
|
}
|
||||||
writer.set_extrusion_flow(m_extrusion_flow); // Reset the extrusion flow.
|
writer.set_extrusion_flow(m_extrusion_flow); // Reset the extrusion flow.
|
||||||
|
|
||||||
// Wipe the nozzle
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::vector<WipeTowerInfo> m_plan; // Stores information about all layers and toolchanges for the future wipe tower (filled by plan_toolchange(...))
|
std::vector<WipeTowerInfo> m_plan; // Stores information about all layers and toolchanges for the future wipe tower (filled by plan_toolchange(...))
|
||||||
std::vector<WipeTowerInfo>::iterator m_layer_info;
|
std::vector<WipeTowerInfo>::iterator m_layer_info = m_plan.end();
|
||||||
|
|
||||||
|
|
||||||
// Returns gcode for wipe tower brim
|
// Returns gcode for wipe tower brim
|
||||||
|
Loading…
x
Reference in New Issue
Block a user