Need help with a block-count lisp

Need help with a block-count lisp

Anonymous
Not applicable
727 Views
6 Replies
Message 1 of 7

Need help with a block-count lisp

Anonymous
Not applicable

I'm trying to create or modify a lisp that will count a specific block among other objects/blocks by way of a selection window. Also, the results of the count will auto-fill a table or a block attribute. To be a bit more specific the count will auto-fill 1 of 4 cells (A, B, C, D)Is this possible? 

 

 

 

I've come across lisps that do similar things and the best one I've found so far is Count Attribute Values by Lee-Mac. I'm hoping to find a way to create a similar lisp that can single-out a specified block and auto-fill a pre-made table or block attribute rather than create a new table.

 

I know QSELECT can isolate a block by name and count by selection window but haven't had luck with an auto-fill.

 

I'm open to any suggestions, variations or alternatives. 

 

Thanks.

0 Likes
728 Views
6 Replies
Replies (6)
Message 2 of 7

ChicagoLooper
Mentor
Mentor

You can do this using DATAEXTRACTION command. It will count blocks and much more. You may extract the data, such as number of blocks, and put it in an external file outside of your dwg or an internal table which is inserted into your drawing.

Chicagolooper

EESignature

0 Likes
Message 3 of 7

Anonymous
Not applicable

Thank you for the reply,

 

The thing with DATAEXTRACTION (or at least to my knowledge of it) is that it counts all instances of the particular block. I only need a count within a selection window. 

0 Likes
Message 4 of 7

ChicagoLooper
Mentor
Mentor

Someone gave you bad info (or you misunderstood what you have read) because dataextraction can indeed use a window.

 

Check: Select objects in the current drawing then click the window button.Check: Select objects in the current drawing then click the window button.

Chicagolooper

EESignature

0 Likes
Message 5 of 7

Anonymous
Not applicable

Ah I see, thanks for the help. To be honest, this is a bit of a lengthier process than what I was hoping for.

0 Likes
Message 6 of 7

ChicagoLooper
Mentor
Mentor

Congratulations. You now know the limitations of your plain ol' AutoCAD blocks. You're limited in how you use them as well as what they can do for you.

 

If you are up to it, you can invest more time and make them smart blocks, meaning they hold more info, way more, such as Object Data, so that later on your investment can save you time by enabling you to perform fast operations such as count all blocks with an attribute beginning with 'QR' or count only blocks with attribute containing 'SB' that reside on layer landscape.

 

You can consider those plain vanilla blocks as blocks on steroids, because you are moving from the JV to the Varsity. If you want to leap frog over Division-I and go directly to Pro, you can export your blocks with OD to shapefile or sdf. When you combine Feature Data Objects (shp, sdf) with Acad entities, you Level Up.

Chicagolooper

EESignature

0 Likes
Message 7 of 7

Anonymous
Not applicable

I definitely have much more to learn. Maybe you can help guide me in the right direction a bit more? The blocks we have do contain data such as customer addresses, group identifiers, etc. The purpose of creating this lisp is to count the amount of customers that belong to different groups (such as group A, B, C, and D).

 

I was able to import data through an ODBC path. This allowed me to accurately plot the customers' as points with important data assigned to each point. I then did an SDF export. The SDF export allowed me to add a color style depending on which group the customer belongs to. 

 

I do have a lot more to learn. I feel like what I have done mentioned above may or may not be useful but I am not sure. Any more advanced suggestions or guidance will be greatly appreciated.

0 Likes