ENH: modify the start pos of wall for wipe tower[affects BBL machines only] (#8439)
and modify the overlap of wall and infill for wipe tower jira:none cherry picked from commit bambulab/BambuStudio@4db196b11f Thanks BambuLab! - Optimize the starting position of the printing wiper tower after material change, the initial print on the wipe tower sometimes had under-extrusion issues, and all layers of wipe tower have the same starting position, increasing the risk of collision. This optimization distributes the initial extrusion over four corners, reducing the accumulation of defects. - Reducing the rivet length between the wipe tower's outer wall and infill to 0mm minimizes the risk of collision when switching between printing infill and outer walls. 
This commit is contained in:
commit
41ff66297b
2 changed files with 44 additions and 24 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
namespace Slic3r
|
||||
{
|
||||
static const double wipe_tower_wall_infill_overlap = 0.0;
|
||||
|
||||
inline float align_round(float value, float base)
|
||||
{
|
||||
|
@ -118,7 +119,7 @@ public:
|
|||
|
||||
WipeTowerWriter& set_initial_tool(size_t tool) { m_current_tool = tool; return *this; }
|
||||
|
||||
WipeTowerWriter& set_z(float z)
|
||||
WipeTowerWriter& set_z(float z)
|
||||
{ m_current_z = z; return *this; }
|
||||
|
||||
WipeTowerWriter& set_extrusion_flow(float flow)
|
||||
|
@ -237,7 +238,7 @@ public:
|
|||
WipeTowerWriter& travel(float x, float y, float f = 0.f)
|
||||
{ return extrude_explicit(x, y, 0.f, f); }
|
||||
|
||||
WipeTowerWriter& travel(const Vec2f &dest, float f = 0.f)
|
||||
WipeTowerWriter& travel(const Vec2f &dest, float f = 0.f)
|
||||
{ return extrude_explicit(dest.x(), dest.y(), 0.f, f); }
|
||||
|
||||
// Extrude a line from current position to x, y with the extrusion amount given by m_extrusion_flow.
|
||||
|
@ -248,7 +249,7 @@ public:
|
|||
return extrude_explicit(x, y, std::sqrt(dx*dx+dy*dy) * m_extrusion_flow, f, true);
|
||||
}
|
||||
|
||||
WipeTowerWriter& extrude(const Vec2f &dest, const float f = 0.f)
|
||||
WipeTowerWriter& extrude(const Vec2f &dest, const float f = 0.f)
|
||||
{ return extrude(dest.x(), dest.y(), f); }
|
||||
|
||||
WipeTowerWriter& rectangle(const Vec2f& ld,float width,float height,const float f = 0.f)
|
||||
|
@ -299,7 +300,7 @@ public:
|
|||
do {
|
||||
++i;
|
||||
if (i == 4) i = 0;
|
||||
if (need_change_flow) {
|
||||
if (need_change_flow) {
|
||||
if (i == 1) {
|
||||
// using bridge flow in bridge area, and add notes for gcode-check when flow changed
|
||||
set_extrusion_flow(wipe_tower->extrusion_flow(0.2));
|
||||
|
@ -358,7 +359,7 @@ public:
|
|||
|
||||
// Elevate the extruder head above the current print_z position.
|
||||
WipeTowerWriter& z_hop(float hop, float f = 0.f)
|
||||
{
|
||||
{
|
||||
m_gcode += std::string("G1") + set_format_Z(m_current_z + hop);
|
||||
if (f != 0 && f != m_current_feedrate)
|
||||
m_gcode += set_format_F(f);
|
||||
|
@ -367,7 +368,7 @@ public:
|
|||
}
|
||||
|
||||
// Lower the extruder head back to the current print_z position.
|
||||
WipeTowerWriter& z_hop_reset(float f = 0.f)
|
||||
WipeTowerWriter& z_hop_reset(float f = 0.f)
|
||||
{ return z_hop(0, f); }
|
||||
|
||||
// Move to x1, +y_increment,
|
||||
|
@ -455,14 +456,14 @@ public:
|
|||
}
|
||||
|
||||
WipeTowerWriter& flush_planner_queue()
|
||||
{
|
||||
m_gcode += "G4 S0\n";
|
||||
{
|
||||
m_gcode += "G4 S0\n";
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Reset internal extruder counter.
|
||||
WipeTowerWriter& reset_extruder()
|
||||
{
|
||||
{
|
||||
m_gcode += "G92 E0\n";
|
||||
return *this;
|
||||
}
|
||||
|
@ -725,7 +726,7 @@ void WipeTower::set_extruder(size_t idx, const PrintConfig& config)
|
|||
// Returns gcode to prime the nozzles at the front edge of the print bed.
|
||||
std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
|
||||
// print_z of the first layer.
|
||||
float initial_layer_print_height,
|
||||
float initial_layer_print_height,
|
||||
// Extruder indices, in the order to be primed. The last extruder will later print the wipe tower brim, print brim and the object.
|
||||
const std::vector<unsigned int> &tools,
|
||||
// If true, the last priming are will be the same as the other priming areas, and the rest of the wipe will be performed inside the wipe tower.
|
||||
|
@ -742,7 +743,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
|
|||
float wipe_depth = 0.f;
|
||||
float wipe_length = 0.f;
|
||||
float purge_volume = 0.f;
|
||||
|
||||
|
||||
// Finds this toolchange info
|
||||
if (tool != (unsigned int)(-1))
|
||||
{
|
||||
|
@ -802,12 +803,30 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
|
|||
box_coordinates wt_box(Vec2f(0.f, (m_current_shape == SHAPE_REVERSED) ? m_layer_info->toolchanges_depth() - m_layer_info->depth : 0.f),
|
||||
m_wipe_tower_width, m_layer_info->depth + m_perimeter_width);
|
||||
// align the perimeter
|
||||
|
||||
Vec2f pos = initial_position;
|
||||
switch (m_cur_layer_id % 4){
|
||||
case 0:
|
||||
pos = wt_box.ld;
|
||||
break;
|
||||
case 1:
|
||||
pos = wt_box.rd;
|
||||
break;
|
||||
case 2:
|
||||
pos = wt_box.ru;
|
||||
break;
|
||||
case 3:
|
||||
pos = wt_box.lu;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
writer.set_initial_position(pos, m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation);
|
||||
|
||||
wt_box = align_perimeter(wt_box);
|
||||
writer.rectangle(wt_box);
|
||||
writer.travel(initial_position);
|
||||
}
|
||||
|
||||
if (first_toolchange_to_nonsoluble) {
|
||||
{
|
||||
writer.travel(Vec2f(0, 0));
|
||||
writer.travel(initial_position);
|
||||
}
|
||||
|
@ -849,7 +868,7 @@ void WipeTower::toolchange_Unload(
|
|||
#if 0
|
||||
float xl = cleaning_box.ld.x() + 1.f * m_perimeter_width;
|
||||
float xr = cleaning_box.rd.x() - 1.f * m_perimeter_width;
|
||||
|
||||
|
||||
const float line_width = m_perimeter_width * m_filpar[m_current_tool].ramming_line_width_multiplicator; // desired ramming line thickness
|
||||
const float y_step = line_width * m_filpar[m_current_tool].ramming_step_multiplicator * m_extra_spacing; // spacing between lines in mm
|
||||
|
||||
|
@ -1108,9 +1127,9 @@ void WipeTower::toolchange_Wipe(
|
|||
}
|
||||
|
||||
if (m_left_to_right)
|
||||
writer.extrude(xr + 0.25f * m_perimeter_width, writer.y(), wipe_speed);
|
||||
writer.extrude(xr + wipe_tower_wall_infill_overlap * m_perimeter_width, writer.y(), wipe_speed);
|
||||
else
|
||||
writer.extrude(xl - 0.25f * m_perimeter_width, writer.y(), wipe_speed);
|
||||
writer.extrude(xl - wipe_tower_wall_infill_overlap * m_perimeter_width, writer.y(), wipe_speed);
|
||||
|
||||
// BBS: recover the flow in non-bridging area
|
||||
if (need_change_flow) {
|
||||
|
@ -1139,7 +1158,7 @@ void WipeTower::toolchange_Wipe(
|
|||
//writer.add_wipe_point(writer.x(), writer.y())
|
||||
// .add_wipe_point(writer.x(), writer.y() - dy)
|
||||
// .add_wipe_point(! m_left_to_right ? m_wipe_tower_width : 0.f, writer.y() - dy);
|
||||
// BBS: modify the wipe_path after toolchange
|
||||
// BBS: modify the wipe_path after toolchange
|
||||
writer.add_wipe_point(writer.x(), writer.y())
|
||||
.add_wipe_point(! m_left_to_right ? m_wipe_tower_width : 0.f, writer.y());
|
||||
|
||||
|
@ -1473,7 +1492,7 @@ void WipeTower::plan_tower()
|
|||
m_wipe_tower_depth = 0.f;
|
||||
for (auto& layer : m_plan)
|
||||
layer.depth = 0.f;
|
||||
|
||||
|
||||
float max_depth_for_all = 0;
|
||||
for (int layer_index = int(m_plan.size()) - 1; layer_index >= 0; --layer_index)
|
||||
{
|
||||
|
@ -1482,7 +1501,7 @@ void WipeTower::plan_tower()
|
|||
this_layer_depth = min_wipe_tower_depth;
|
||||
|
||||
m_plan[layer_index].depth = this_layer_depth;
|
||||
|
||||
|
||||
if (this_layer_depth > m_wipe_tower_depth - m_perimeter_width)
|
||||
m_wipe_tower_depth = this_layer_depth + m_perimeter_width;
|
||||
|
||||
|
@ -1492,7 +1511,7 @@ void WipeTower::plan_tower()
|
|||
m_plan[i].depth = this_layer_depth;
|
||||
}
|
||||
|
||||
if (m_enable_timelapse_print && layer_index == 0)
|
||||
if (m_enable_timelapse_print && layer_index == 0)
|
||||
max_depth_for_all = m_plan[0].depth;
|
||||
}
|
||||
|
||||
|
@ -1600,10 +1619,11 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
|
|||
used = 0.f;
|
||||
|
||||
m_old_temperature = -1; // reset last temperature written in the gcode
|
||||
|
||||
int index = 0;
|
||||
std::vector<WipeTower::ToolChangeResult> layer_result;
|
||||
for (auto layer : m_plan)
|
||||
{
|
||||
m_cur_layer_id = index++;
|
||||
set_layer(layer.z, layer.height, 0, false/*layer.z == m_plan.front().z*/, layer.z == m_plan.back().z);
|
||||
// BBS
|
||||
//m_internal_rotation += 180.f;
|
||||
|
@ -1627,14 +1647,14 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
|
|||
// if there is no toolchange switching to non-soluble, finish layer
|
||||
// will be called at the very beginning. That's the last possibility
|
||||
// where a nonsoluble tool can be.
|
||||
if (m_enable_timelapse_print) {
|
||||
if (m_enable_timelapse_print) {
|
||||
timelapse_wall = only_generate_out_wall();
|
||||
}
|
||||
finish_layer_tcr = finish_layer(m_enable_timelapse_print ? false : true, layer.extruder_fill);
|
||||
}
|
||||
|
||||
for (int i=0; i<int(layer.tool_changes.size()); ++i) {
|
||||
if (i == 0 && m_enable_timelapse_print) {
|
||||
if (i == 0 && m_enable_timelapse_print) {
|
||||
timelapse_wall = only_generate_out_wall();
|
||||
}
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ private:
|
|||
float m_travel_speed = 0.f;
|
||||
float m_first_layer_speed = 0.f;
|
||||
size_t m_first_layer_idx = size_t(-1);
|
||||
|
||||
size_t m_cur_layer_id;
|
||||
// G-code generator parameters.
|
||||
float m_cooling_tube_retraction = 0.f;
|
||||
float m_cooling_tube_length = 0.f;
|
||||
|
|
Loading…
Reference in a new issue