Skip to content

Commit 84d3bd2

Browse files
authored
Fix: Grid size calculation wrong on large scale (OrcaSlicer#9500)
* Update PartPlate.cpp * Update PartPlate.cpp * add descriptions * simplify calculations
1 parent 5bf1596 commit 84d3bd2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/slic3r/GUI/PartPlate.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,16 @@ void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox
468468

469469
Polylines axes_lines, axes_lines_bolder;
470470
int count = 0;
471-
int step = 10;
471+
int step = 10; // Uses up to 599mm Main Grid: 10 x 5 = 50mm
472472
// Orca: use 500 x 500 bed size as baseline.
473-
const Point grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
474473
// if the grid is too dense, we increase the step
475-
if (grid_counts.minCoeff() > 1) {
476-
step = static_cast<int>(grid_counts.minCoeff() + 1) * 10;
477-
}
474+
auto min_edge_scaled = (pp_bbox.size() / ((coord_t) scale_(1))).minCoeff();
475+
if ( min_edge_scaled >= 6000) // Switch when short edge >= 6000mm Main Grid: 100 x 5 = 500mm
476+
step = 100;
477+
else if (min_edge_scaled >= 1200) // Switch when short edge >= 1200mm Main Grid: 50 x 5 = 250mm
478+
step = 50;
479+
else if (min_edge_scaled >= 600) // Switch when short edge >= 600mm Main Grid: 20 x 5 = 100mm
480+
step = 20;
478481

479482
// ORCA draw grid lines relative to origin
480483
for (coord_t x = scale_(m_origin.x()); x >= pp_bbox.min(0); x -= scale_(step)) { // Negative X axis

0 commit comments

Comments
 (0)