From 985bb54748a2798cd46d6fae07e24570b125c629 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 26 May 2023 12:38:24 +0200 Subject: [PATCH] Conflict checker: take the wipe tower into account --- src/libslic3r/Print.cpp | 4 ++++ src/libslic3r/Print.hpp | 29 ++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index a184c1ccd..c2a20e034 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1526,6 +1526,10 @@ void Print::_make_wipe_tower() m_wipe_tower_data.used_filament = wipe_tower.get_used_filament(); m_wipe_tower_data.number_of_toolchanges = wipe_tower.get_number_of_toolchanges(); + const Vec3d origin = Vec3d::Zero(); + m_fake_wipe_tower.set_fake_extrusion_data(wipe_tower.position(), wipe_tower.width(), wipe_tower.get_wipe_tower_height(), config().first_layer_height, m_wipe_tower_data.depth, + m_wipe_tower_data.brim_width, config().wipe_tower_rotation_angle, {scale_(origin.x()), scale_(origin.y())}); + } // Generate a recommended G-code output file name based on the format template, default extension, and template parameters diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 5449d4897..47fc3ebb0 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -427,9 +427,10 @@ struct FakeWipeTower float layer_height; float depth; float brim_width; + float rotation_angle; Vec2d plate_origin; - void set_fake_extrusion_data(const Vec2f& p, float w, float h, float lh, float d, float bd, const Vec2d& o) + void set_fake_extrusion_data(const Vec2f& p, float w, float h, float lh, float d, float bd, float ra, const Vec2d& o) { pos = p; width = w; @@ -437,6 +438,7 @@ struct FakeWipeTower layer_height = lh; depth = d; brim_width = bd; + rotation_angle = ra; plate_origin = o; } @@ -449,15 +451,36 @@ struct FakeWipeTower int d = scale_(depth); int w = scale_(width); int bd = scale_(brim_width); - Point minCorner = { scale_(pos.x()), scale_(pos.y()) }; - Point maxCorner = { minCorner.x() + w, minCorner.y() + d }; + Point minCorner = { -bd, -bd }; + Point maxCorner = { minCorner.x() + w + bd, minCorner.y() + d + bd }; std::vector paths; for (float hh = 0.f; hh < h; hh += lh) { ExtrusionPath path(ExtrusionRole::WipeTower, 0.0, 0.0, lh); path.polyline = { minCorner, {maxCorner.x(), minCorner.y()}, maxCorner, {minCorner.x(), maxCorner.y()}, minCorner }; paths.push_back({ path }); + + // We added the border, now add several parallel lines so we can detect an object that is fully inside the tower. + // For now, simply use fixed spacing of 3mm. + for (coord_t y=minCorner.y()+scale_(3.); y