From 071f88de13f6f2d8f2d08d02e4640930371025c6 Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Thu, 27 Jul 2023 12:26:09 +0200 Subject: [PATCH] Fix Missing text line od edge of object with Function "per glyph orientation" enabled --- src/slic3r/GUI/TextLines.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/slic3r/GUI/TextLines.cpp b/src/slic3r/GUI/TextLines.cpp index 55002fcf63..d1a014d609 100644 --- a/src/slic3r/GUI/TextLines.cpp +++ b/src/slic3r/GUI/TextLines.cpp @@ -283,6 +283,24 @@ void TextLinesModel::init(const Transform3d &text_tr, } } + // fix for text line out of object + // When move text close to edge - line center could be out of object + for (Polygons &contours: line_contours) { + if (!contours.empty()) + continue; + + // use line center at zero, there should be some contour. + float line_center = 0.f; + for (const ModelVolume *volume : volumes_to_slice) { + MeshSlicingParams slicing_params; + slicing_params.trafo = c_trafo_inv * volume->get_matrix(); + const Polygons polys = Slic3r::slice_mesh(volume->mesh().its, line_center, slicing_params); + if (polys.empty()) + continue; + contours.insert(contours.end(), polys.begin(), polys.end()); + } + } + m_lines = select_closest_contour(line_contours); assert(m_lines.size() == count_lines); assert(line_centers.size() == count_lines);