Count up counter for consecutive number labeling

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)

Hi riverbuoy,

very nice - thank you so much for this important (at least for me!) improvement. I really appreciate it. :smiley: :smiley: :smiley:

Is it possible to set up a counter to automatically add up the blocks so every time i add a smoke detector to my drawing it will add to the right column

@riverbuoy I just want to give you thanks and kudos for this. I have to number wires on a regular basis, and this is close to perfect. It’s not AutoCAD electrical (No BOM or wire usage/load and Qcad doesn’t support those) but it certainly makes a tedious task much more pleasant.

Thank you!
Bill J.

Hi,
I can tell you that we don’t have something like that in the current QCAD Version but I can’t tell you what the developers have already in the pipe … :wink:

However - what I can tell you definitive is that the current QCAD Version has already a little simple script which will count blocks. :open_mouth:
Maybe that is something what you can use to doublecheck your chart …

Menu / Misk …