mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-06 22:47:32 -06:00
Fix: Grid size calculation wrong on large scale (#9500)
* Update PartPlate.cpp * Update PartPlate.cpp * add descriptions * simplify calculations
This commit is contained in:
parent
5bf1596d65
commit
84d3bd2b48
1 changed files with 8 additions and 5 deletions
|
@ -468,13 +468,16 @@ void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox
|
||||||
|
|
||||||
Polylines axes_lines, axes_lines_bolder;
|
Polylines axes_lines, axes_lines_bolder;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int step = 10;
|
int step = 10; // Uses up to 599mm Main Grid: 10 x 5 = 50mm
|
||||||
// Orca: use 500 x 500 bed size as baseline.
|
// Orca: use 500 x 500 bed size as baseline.
|
||||||
const Point grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
|
|
||||||
// if the grid is too dense, we increase the step
|
// if the grid is too dense, we increase the step
|
||||||
if (grid_counts.minCoeff() > 1) {
|
auto min_edge_scaled = (pp_bbox.size() / ((coord_t) scale_(1))).minCoeff();
|
||||||
step = static_cast<int>(grid_counts.minCoeff() + 1) * 10;
|
if ( min_edge_scaled >= 6000) // Switch when short edge >= 6000mm Main Grid: 100 x 5 = 500mm
|
||||||
}
|
step = 100;
|
||||||
|
else if (min_edge_scaled >= 1200) // Switch when short edge >= 1200mm Main Grid: 50 x 5 = 250mm
|
||||||
|
step = 50;
|
||||||
|
else if (min_edge_scaled >= 600) // Switch when short edge >= 600mm Main Grid: 20 x 5 = 100mm
|
||||||
|
step = 20;
|
||||||
|
|
||||||
// ORCA draw grid lines relative to origin
|
// ORCA draw grid lines relative to origin
|
||||||
for (coord_t x = scale_(m_origin.x()); x >= pp_bbox.min(0); x -= scale_(step)) { // Negative X axis
|
for (coord_t x = scale_(m_origin.x()); x >= pp_bbox.min(0); x -= scale_(step)) { // Negative X axis
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue