https://www.qcad.org/rsforum/viewtopic.php?f=95&t=10149
https://www.qcad.org/rsforum/viewtopic.php?f=8&t=8761
And a bug report exists here:
https://www.qcad.org/bugtracker/index.p ... sk_id=2284
I mainly refer to code for an orthogonal metric grid here: https://github.com/qcad/qcad/blob/maste ... hoGrid.cpp
Line 395 retrieves an ideal minimum grid spacing based on the minPixelSpacing (minDevicePixelSpacing) value and the view factor.
On lines 394 is mentioned that the result may be some odd number.
The idea is now to format the grid spacing automatically depending the zoom state in nice 10 based steps.
The grid spacing is then calculated in 5 distinct code sections:
- Line 398 divides this (odd) value by minSpacing for an idealFactor in X and Y.
- This idealFactor is again divided by minSpacing and of that the 10 based log is stored as exponent n in X and Y.
- A factor in X and Y is created equal to minSpacing times 10^n where n is rounded up to an integer after subtracting a tiny amount.
- Lines 409 - 415 will restrict these factors to not less than 1.
- In 417 - 421 the grid spacing is calculated as minSpacing times the factors.
Meaning that:
- For factors less than 1 we get a grid spacing of minSpacing * 1
- With n rounded to integers and equal to zero we get a grid spacing of minSpacing * minSpacing * 10^0(=1)
- With larger integers for n we get a grid spacing of minSpacing * minSpacing * 10^n(=10, 100, 1000 ...)
And that is conform my findings in the provided lists:
Grid Spacing = 1.5 >>> Auto grid steps : 1.5 - 2.25 - 22.5 - 225 - 2250 - ...
Grid Spacing = 0.0625 >>> Auto grid steps : 0.0625 - 0.390625 - 3.90625 - 39.0625 - ...
Other example lists can be found here: https://qcad.org/rsforum/viewtopic.php?t=8761#p34738
It only works seemingly correct when the Grid Spacing preference is unit based like 10, 1, 0.1 or 0.01 ... (As listed in the combo box)
Andrew's advice to freeze the grid is not a proper solution as it doesn't automatically scale the grid anymore when zooming out.
It is of no use to re-enter a bug report as there is an open one by Stan Tibbs - 27.09.2021.
It doesn't serve anything to add this explanation to the mentioned user posts.
Maybe it is picked up this way, I'll add a link in the bug report and PM it to Andrew ...
The division by minSpacing under a log() is not counteracted by multiplying it an extra second time.
IMHO one needs to retrieve the ideal minimum grid spacing, divide that by the minSpacing.
Then define the rounded exponent n and return minSpacing times 10^n where n is restricted to zero or larger.
Regards,
CVH