From daf4b4ef74bab5dbf6333a4ffe220af44c01a958 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Sat, 10 Dec 2022 14:45:03 +0800 Subject: [PATCH] FIX: fix the bed position not correct issue for 3rd printers also remove the unused gridlines in 3dBed Change-Id: I547bf8f48c9d79ed831ed0872699ad1da1185da8 --- src/slic3r/GUI/3DBed.cpp | 17 +++++++++-------- src/slic3r/GUI/3DBed.hpp | 4 ++-- src/slic3r/GUI/Plater.cpp | 4 ++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 0cbe9b7e8..1ef1e0f1f 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -252,7 +252,7 @@ bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_heig m_extended_bounding_box = this->calc_extended_bounding_box(false); //BBS: add part plate logic - + //BBS add default bed #if 1 ExPolygon poly{ Polygon::new_scale(printable_area) }; @@ -265,10 +265,11 @@ bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_heig calc_triangles(poly); - const BoundingBox& bed_bbox = poly.contour.bounding_box(); - calc_gridlines(poly, bed_bbox); + //no need gridline for 3dbed + //const BoundingBox& bed_bbox = poly.contour.bounding_box(); + //calc_gridlines(poly, bed_bbox); - m_polygon = offset(poly.contour, (float)bed_bbox.radius() * 1.7f, jtRound, scale_(0.5))[0]; + //m_polygon = offset(poly.contour, (float)bed_bbox.radius() * 1.7f, jtRound, scale_(0.5))[0]; if (with_reset) { this->release_VBOs(); @@ -391,7 +392,7 @@ void Bed3D::calc_triangles(const ExPolygon& poly) void Bed3D::calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox) { - Polylines axes_lines; + /*Polylines axes_lines; for (coord_t x = bed_bbox.min.x(); x <= bed_bbox.max.x(); x += scale_(10.0)) { Polyline line; line.append(Point(x, bed_bbox.min.y())); @@ -413,7 +414,7 @@ void Bed3D::calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox) std::copy(contour_lines.begin(), contour_lines.end(), std::back_inserter(gridlines)); if (!m_gridlines.set_from_lines(gridlines, GROUND_Z)) - BOOST_LOG_TRIVIAL(error) << "Unable to create bed grid lines\n"; + BOOST_LOG_TRIVIAL(error) << "Unable to create bed grid lines\n";*/ } // Try to match the print bed shape with the shape of an active profile. If such a match exists, @@ -716,7 +717,7 @@ void Bed3D::render_default(bool bottom) const glsafe(::glDepthMask(GL_TRUE)); } - if (!picking) { + /*if (!picking) { // draw grid glsafe(::glLineWidth(1.5f * m_scale_factor)); if (has_model && !bottom) @@ -725,7 +726,7 @@ void Bed3D::render_default(bool bottom) const glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 0.6f)); glsafe(::glVertexPointer(3, GL_FLOAT, default_triangles.get_vertex_data_size(), (GLvoid*)m_gridlines.get_vertices_data())); glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines.get_vertices_count())); - } + }*/ glsafe(::glDisableClientState(GL_VERTEX_ARRAY)); diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index a210d6c85..af3f22591 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -90,9 +90,9 @@ private: // Print volume bounding box exteded with axes and model. BoundingBoxf3 m_extended_bounding_box; // Slightly expanded print bed polygon, for collision detection. - Polygon m_polygon; + //Polygon m_polygon; GeometryBuffer m_triangles; - GeometryBuffer m_gridlines; + //GeometryBuffer m_gridlines; GLTexture m_texture; // temporary texture shown until the main texture has still no levels compressed //GLTexture m_temp_texture; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 1364c93cb..0a03d4bba 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6832,6 +6832,10 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar //Pointfs& exclude_areas = config->option("bed_exclude_area")->values; partplate_list.reset_size(max.x() - min.x(), max.y() - min.y(), z); partplate_list.set_shapes(shape, exclude_areas, custom_texture, height_to_lid, height_to_rod); + + Vec2d new_shape_position = partplate_list.get_current_shape_position(); + if (shape_position != new_shape_position) + bed.set_shape(shape, printable_height, custom_model, force_as_custom, new_shape_position); } }