FIX: fix the bed position not correct issue for 3rd printers

also remove the unused gridlines in 3dBed

Change-Id: I547bf8f48c9d79ed831ed0872699ad1da1185da8
This commit is contained in:
lane.wei 2022-12-10 14:45:03 +08:00 committed by Lane.Wei
parent 5c3c2fcb1c
commit daf4b4ef74
3 changed files with 15 additions and 10 deletions

View File

@ -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));

View File

@ -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;

View File

@ -6832,6 +6832,10 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
//Pointfs& exclude_areas = config->option<ConfigOptionPoints>("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);
}
}