Field that counts the number of blocks in AutoCAD

Field that counts the number of blocks in AutoCAD

Anonymous
Not applicable
9,821 Views
16 Replies
Message 1 of 17

Field that counts the number of blocks in AutoCAD

Anonymous
Not applicable

After selecting "insert field", going under "Object", and selecting a block, for there to be a selction for the number of times that block is in a drawing. Data Extraction just isn't efficient or offer the flexibility to be a legitimate option for counting blocks.

0 Likes
9,822 Views
16 Replies
Replies (16)
Message 2 of 17

Patchy
Mentor
Mentor

How about BCOUNT

Message 3 of 17

Anonymous
Not applicable

BCOUNT is cool, but it's not something that I can get to populate a field. It just seems like there should be a way to get CAD to help automate cut sheets, BOM's, ect.

0 Likes
Message 4 of 17

Anonymous
Not applicable
Hello, I have the same issue here. I need to count a lot of parking spaces, they are nested in another block, each parking space have attributes for identification, etc. I was thinking in an option in the field categories that count blocks inside other block and auto-update if the amount of blocks nested is modified. Any ideas? Please?
Thanks in advance.
0 Likes
Message 5 of 17

Anonymous
Not applicable

I've can get a chart to count blocks and update, but only in Mechanical. Do you happen to have access to AutoCAD Mechanical?

0 Likes
Message 6 of 17

Anonymous
Not applicable
Not right now in this computer, but please tell me about that chart.
0 Likes
Message 7 of 17

Anonymous
Not applicable

It's been a while since I've messed around with this, but this is what got me started down the path of being able to have the quantity of blocks in a drawing update a material list. When you get a chance to use something with Mechanical on it, give this a whirl. I can confirm that it works with both blocks and dynamic blocks.

 

Block Counter.jpg

Message 8 of 17

Anonymous
Not applicable
Ok, thank you, I'll try it ASAP.
0 Likes
Message 9 of 17

johnaerickson68
Community Visitor
Community Visitor

I know this was an old post but someone might need this answer in the future. 

My advice is to use the data extraction wizard

 

Make sure on page 2 of 8 in the Data Source section to choose select objects in the current drawing and then select everything in your drawing. The next few pages are about filtering out the available data from the objects you are  extracting from but the final table that you get will give you a table or output to a data file that includes the total count.  Whenever the number or blocks changes you can select your table and right mouse click to get to Update the Table Data Links which will update your data (i.e. recount the total number of blocks)

0 Likes
Message 10 of 17

amapostolou
Advocate
Advocate

I found a way to add Count to a field.  Once the Count command is used, there's a graphic at the top that has other Count options.  One is to insert a Field.  When I select that, it asks where to place it, so I did.  It's a text element with a field.  If you double-click to edit, this is what gets displayed ... 

aapostolou62A7K_0-1648579577522.png

 

I am interested to find any documentation that explains what all that means and how to use it.

 

For now, I create the Field using Count, then copy and paste the Expression in my table, notes, etc. and delete the original Field that got placed.  A little time consuming.

 

Regards,

Anthony

0 Likes
Message 11 of 17

xsteinbachx
Explorer
Explorer

I wish you were able to copy the code versus the screenshot. I don't get the same code as you, as yours seems to do the whole drawing.

0 Likes
Message 12 of 17

amapostolou
Advocate
Advocate

Here's the actual text for different count searches.

 

{"countingArea":[],"key":{"parameters":[{"name":"Visibility1","unitType":0,"value":"3 Coils"}]},"name":"Coil_Insert","type":"block"}

 

{"countingArea":[],"key":{"parameters":[{"name":"Visibility1","unitType":0,"value":"2 Coils"}]},"name":"Coil_Insert","type":"block"}

 

{"countingArea":[],"key":{"parameters":[{"name":"Visibility1","unitType":0,"value":"1 Coil"}]},"name":"Coil_Insert","type":"block"}

 

{"countingArea":[],"key":{},"name":"BC1","type":"block"}

Message 13 of 17

xsteinbachx
Explorer
Explorer

Thank you!

0 Likes
Message 14 of 17

jreidKVSUZ
Advocate
Advocate

This is not fields but is one of the best LISP files I have used. But you must have Full AutoCAD and not Lite.

Type in AP and Drag Drop the BLOCKCOUNT.lsp into the folder that just popped up and select said file and load then type BLOCKCOUNT. This counts the blocks and makes your legend to show what the block looks like, the block name and how many.

I renamed the LISP file and its program name because I can remember BLOCKCOUNT but might forget what the original name was called.

 

One note, always do a search for a LISP file that may do what you are asking for.

 

Enjoy!

JRR!

 

The Original creator's Link:

https://forums.autodesk.com/t5/autocad-forum/block-count-tool-in-2022-version/td-p/10407475

 

Message 15 of 17

JLugoPQ67N
Observer
Observer

Question:

 

"countingArea":[] is for the entire model space. What about if I want to count the blocks in a defined area? that is possible?

 

Regards,

 

Jessy

0 Likes
Message 16 of 17

pendean
Community Legend
Community Legend

@JLugoPQ67N wrote:

...What about if I want to count the blocks in a defined area? that is possible?...


Did you try the COUNT command yet? Look it up in HELP in your AutoCAD variant.

Message 17 of 17

JLugoPQ67N
Observer
Observer

Thank you,

I was using this expression to count specific blocks with a specific layer, but that count in the entire model space

{"countingArea":[],"key":{"layer":"LAYER"},"name":"BLOCK","type":"block"}

Screenshot 2025-03-11 164447.png

I change to CountInArea field name and I use this expression to count in a specific area:

 

{"boundaryObjectHandle":"HANDLE","evaluatorId":"AcCount2","key":{"layer":"LAYER"},"name":"BLOCK","type":"block"}Screenshot 2025-03-11 164832.png

 

0 Likes