ENH: Change the collision calculation
of the wipe tower's outer wall to use the actual outer wall path. jira: none Change-Id: Ib45ecbc328c88c1abe6d9e8567f715331a3ddd37 (cherry picked from commit 0a20f1fe6d6d63cdcb13bc19fd9ae553f45b6f59)
This commit is contained in:
@@ -224,7 +224,8 @@ ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(PrintObjectP
|
||||
LinesBucketQueue conflictQueue;
|
||||
|
||||
if (wtdptr.has_value()) { // wipe tower at 0 by default
|
||||
auto wtpaths = wtdptr.value()->getFakeExtrusionPathsFromWipeTower();
|
||||
//auto wtpaths = wtdptr.value()->getFakeExtrusionPathsFromWipeTower();
|
||||
auto wtpaths = wtdptr.value()->getTrueExtrusionPathsFromWipeTower();
|
||||
ExtrusionLayers wtels;
|
||||
wtels.type = ExtrusionLayersType::WIPE_TOWER;
|
||||
for (int i = 0; i < wtpaths.size(); ++i) { // assume that wipe tower always has same height
|
||||
|
||||
@@ -2959,26 +2959,17 @@ WipeTower::ToolChangeResult WipeTower::finish_layer_new(bool extrude_perimeter,
|
||||
// for skirt calculation and pass it to GLCanvas for precise preview box
|
||||
m_wipe_tower_brim_width_real = loops_num * spacing + spacing / 2.f;
|
||||
//m_wipe_tower_brim_width_real = wt_box.ld.x() - box.ld.x() + spacing / 2.f;
|
||||
|
||||
// set wipe_tower_bbx
|
||||
auto real_polygon = outer_wall;
|
||||
real_polygon = offset(real_polygon, scaled(spacing/2.f)).front();
|
||||
auto real_box = get_extents(real_polygon);
|
||||
m_wipe_tower_bbx = BoundingBoxf(unscale(real_box.min), unscale(real_box.max));
|
||||
}
|
||||
//wt_box = box;
|
||||
}
|
||||
else {
|
||||
if (first_layer) {
|
||||
auto real_polygon = outer_wall;
|
||||
real_polygon = offset(real_polygon, scaled(spacing / 2.f)).front();
|
||||
auto real_box = get_extents(real_polygon);
|
||||
m_wipe_tower_bbx = BoundingBoxf(unscale(real_box.min), unscale(real_box.max));
|
||||
}
|
||||
}
|
||||
|
||||
if (extrude_perimeter || loops_num > 0)
|
||||
if (extrude_perimeter || loops_num > 0) {
|
||||
writer.add_wipe_path(outer_wall, m_filpar[m_current_tool].wipe_dist);
|
||||
if (!extrude_perimeter)
|
||||
m_outer_wall.back() = to_polyline(outer_wall);
|
||||
else
|
||||
m_outer_wall.push_back(to_polyline(outer_wall));
|
||||
}
|
||||
else {
|
||||
// Now prepare future wipe. box contains rectangle that was extruded last (ccw).
|
||||
Vec2f target = (writer.pos() == wt_box.ld ? wt_box.rd : (writer.pos() == wt_box.rd ? wt_box.ru : (writer.pos() == wt_box.ru ? wt_box.lu : wt_box.ld)));
|
||||
@@ -3630,7 +3621,7 @@ void WipeTower::generate_new(std::vector<std::vector<WipeTower::ToolChangeResult
|
||||
int wall_filament = get_wall_filament_for_all_layer();
|
||||
|
||||
std::vector<WipeTower::ToolChangeResult> layer_result;
|
||||
|
||||
m_outer_wall.reserve(m_plan.size());
|
||||
int index = 0;
|
||||
for (auto layer : m_plan) {
|
||||
reset_block_status();
|
||||
@@ -3790,6 +3781,7 @@ void WipeTower::generate_new(std::vector<std::vector<WipeTower::ToolChangeResult
|
||||
}
|
||||
result.emplace_back(std::move(layer_result));
|
||||
}
|
||||
assert(m_outer_wall.size() == m_plan.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -3939,13 +3931,13 @@ WipeTower::ToolChangeResult WipeTower::only_generate_out_wall(bool is_new_mode)
|
||||
//else
|
||||
// writer.rectangle(wt_box, feedrate);
|
||||
outer_wall = generate_support_wall_new(writer, wt_box, feedrate, first_layer, m_use_rib_wall, true, m_use_gap_wall);
|
||||
m_outer_wall.push_back( to_polyline(outer_wall));
|
||||
// Now prepare future wipe. box contains rectangle that was extruded last (ccw).
|
||||
|
||||
// Vec2f target = (writer.pos() == wt_box.ld ? wt_box.rd : (writer.pos() == wt_box.rd ? wt_box.ru : (writer.pos() == wt_box.ru ? wt_box.lu : wt_box.ld)));
|
||||
//writer.add_wipe_point(writer.pos()).add_wipe_point(target);
|
||||
|
||||
writer.add_wipe_path(outer_wall, m_filpar[m_current_tool].wipe_dist);
|
||||
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Tower_End) + "\n");
|
||||
|
||||
// Ask our writer about how much material was consumed.
|
||||
|
||||
@@ -187,7 +187,19 @@ public:
|
||||
Polygon generate_rib_polygon(const box_coordinates &wt_box);
|
||||
float get_depth() const { return m_wipe_tower_depth; }
|
||||
float get_brim_width() const { return m_wipe_tower_brim_width_real; }
|
||||
BoundingBoxf get_bbx() const { return m_wipe_tower_bbx; }
|
||||
BoundingBoxf get_bbx() const {
|
||||
BoundingBox box = get_extents(m_outer_wall.front());
|
||||
BoundingBoxf res = BoundingBoxf(unscale(box.min), unscale(box.max));
|
||||
return res;
|
||||
}
|
||||
Polylines get_outer_wall() const {
|
||||
Polylines res = m_outer_wall;
|
||||
Point trans = scaled(m_rib_offset);
|
||||
for (auto &polyline : res)
|
||||
for (auto &p : polyline.points)
|
||||
p += trans;
|
||||
return res;
|
||||
}
|
||||
float get_height() const { return m_wipe_tower_height; }
|
||||
float get_layer_height() const { return m_layer_height; }
|
||||
|
||||
@@ -456,8 +468,8 @@ private:
|
||||
bool m_left_to_right = true;
|
||||
float m_extra_spacing = 1.f;
|
||||
float m_tpu_fixed_spacing = 2;
|
||||
BoundingBoxf m_wipe_tower_bbx;
|
||||
std::vector<Vec2f> m_wall_skip_points;
|
||||
std::vector<Polyline> m_outer_wall;
|
||||
bool is_first_layer() const { return size_t(m_layer_info - m_plan.begin()) == m_first_layer_idx; }
|
||||
|
||||
// Calculates length of extrusion line to extrude given volume
|
||||
|
||||
Reference in New Issue
Block a user