Hi,
While learning Ecmascript, I have used a function that always prints a fixed number of digits after the decimal point. It dawned on me that this was the perfect answer to fixing the problem of showing trailing zeroes in this command. So I have altered this command. It now has a spin box labelled ‘Precision’, which has a minimum value of zero, and a maximum value of seventeen. (Ecmascript can display up to 17 digits of precision). The value in the box wraps around, so if it is displaying 0, and you click the down arrow, it will wrap around to 17. If it is displaying 17, and you press the up arrow, it will wrap around to 0.
You use this value to determine how many digits should appear after the decimal point. If you wish to use whole numbers, set the precision to zero. So with a start number of 1, an increment of 1, and precision of 0, this will display:-
1, 2, 3, 4, …
If you set precision to 1, you will get:-
1.0, 2.0, 3.0, 4.0, …
If you set precision to 2, and increment to 0.1, you will get:-
1.00, 1.10, 1.20, 1.30, …
If you set increment to 0.01, you will get:-
1.00, 1.01, 1.02, 1.03, … 1.09, 1.10, 1.11 … 1.99, 2.00 …
The thing to remember, is that the precision should be set to at least the number of digits in the increment. So if the increment is 0.001, then precision should be set to at least three.
The advantage of this, is that you no longer have to change anything in ‘Drawing Preferences’, when using fractional numbers.
The change affects two files, which I have attached. These should be put in the directory ‘scripts/Misc/MiscDraw/Counter’, replacing the existing files.
I regard this as an important update, so if you are going to be using this command, you should definitely replace these files.
Regards
riverbuoy
Counter.ui (2.4 KB)
Counter.js (4.16 KB)


