Jump to content

Attributed block count/ extraction


Recommended Posts

I would like to extract a furniture schedule by using attributed blocks. I would like attributes like Item #, Color, Size, Location, Description, Manufacturer, etc…. The problem with the data extraction system that I am having is that in order for a chair with a tag to be considered the same chair and be counted correctly all the block attributes have to be exactly the same/ match.


For example, if I have the same chair (CH-01) but the location of the chair changes, cad treats it as 2 different chairs.


Anyone know of a solution to this issue I am having?




Link to comment
Share on other sites

Did you Try DATAEXTRACTION, if this is no good you can do a output say block by block and count them up etc with lisp etc you can realisticly do anything you want in terms of output. Can you explain more your method.

Link to comment
Share on other sites

Hi BIGAL, thank you for taking the time to help me out with this.

What I have is an attributed block with a variety of attributes. I would like to be able to have CAD count the blocks that are the same (but have one or more attributes that are different). The trouble I am having is that as soon as one of the attributes in the block is different, CAD counts this as a completely different block. The example I used was having a chair TAG block with attributes such as chair size, chair finish, chair description, chair location. I use _dataextraction and when all the attributes are the same, GREAT no issues. Now lets say that the same chair is being used in the living room as well as the kitchen. The chair is the SAME chair so I need it to be counted as the same chair, however when one of the attributes is different (in this case the location) it gets its own count. The bottom line being that I would like all CH-01 to be counted despite the attribute values being different.


Link to comment
Share on other sites

1st count all blocks as same name = 52

2nd count block name but attrib1 = 26

3rd count block name but attrib2 = 26 total still 52


You probably need a multi depth loop to start at block name and then how many levels deep could just open a block and count no of attributes this would define depth required.


USE ssget with block1 then make another selection set 1st attrib then another selection set attrib2 a bit like a pyramid or tree answer.


It is achieveable just need to keep looping other alternative is create a CSV file of blockname plus all attributes and multi column sort using excel then in column "IF next is different" add to sum = table of contents



52 26 26

52 26 26 12 12 18 10

Link to comment
Share on other sites

Welcome to the forum. :)


I suggest you check out Lee Mac's excellent site,

where I am sure you can find a tool which will do what you need.

I am not sure which one will do it, but I am sure one of them will.

Check out all the wonderful tools

which Lee has very generously made available.


Thanks Lee! :beer:

Link to comment
Share on other sites

I knwo this is most likely not the answer you are looking for, but I much prefer using the ATTEXT (Attribute Extraction) and filter the raw data in excel myelf. I find it takes much less tweaking and Excel has many more powerful tools for manipulating the data.

Link to comment
Share on other sites

I agree with Mike use excel but if you still want a custom solution there may be an easy way you can get at the attributes by their created order so you never need to know there tag name or how many, the advantage of this is you can have as many attributes as you like because you get the loopcounter from the number of attribs.


Here is a cut and paste pretty close (original by Lee mac) I will try and find the code that I know works I think its at home.


(setq ss1 (_ssget "\nSelect Source Block: " "_+.:E:S" '((0 . "INSERT") (66 . 1))))
(repeat (setq inc (sslength ss1))
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss1 (setq inc (1- inc)))) 'getattributes)
; i think it was 
(setq val (vla-get-value att))
(princ val) ; here is where you would do a STRCAT make a list then write line 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...