View Full Version : Block Attributes
mabroadb
24-02-2005, 09:27 PM
Hi I've made a block that has three text attributes. I'm having difficulty writing a program that searches the drawing for all of the the blocks and lets me check the attribute data on each of them.
Any help on this problem would be appreciated.
Thanks,
Mike
Eddie
24-02-2005, 11:00 PM
Well what have you got so far ?
mabroadb
24-02-2005, 11:09 PM
Yes I suppose that would help.
Well I've tried doing the following
Set objblock = ThisDrawing.Blocks.Item("p_attribs")
Set objattribs = getattributes(objblock)
Set objattrib = objattribs.Item("POINTNUMBER")
strattribs = objattrib.TextString
where "getattributes" does pretty much exactly what you'd think, but all that does is select the Pointnumber tab from the reference block(which has no data). I need to be able to obtain the varying attribute information from all of the blocks with the same name "p_attribs".
I concluded that I needed to form a selection set of all the "p_attribs" blocks in my drawing and am right now working on filtering the data for blocks. I've tried a couple ways so far based on layer without any success.
Any help in these areas would be appreciated.
Mike
mabroadb
24-02-2005, 11:43 PM
Ok I've obtained a selection set of my blocks, I just don't know how to access the attribute data from an AcadObject.
hendie
25-02-2005, 08:24 AM
Once you have created a selection set of your blocks, you have to iterate through the selection set getting each block in turn. As you grab each block, you then grab the attributes for that block... do what you need to with the atttributes, then move on to the next block
if it's a prticular block or blocks that you are after include a filter when creating your selection set
Eddie
25-02-2005, 11:42 AM
Here is an example on how you could get the attributes..
Also here is another post that may be of assistance..
http://www.autocadeverything.com/phpBB/ftopic316.php
'************************************************
Dim BlockAtt As Variant
Dim AttributeString As String
For Each Block In ThisDrawing.Blocks
'**** get the block attributes ********
BlockAtt = Block.GetAttributes
AttributeString = BlockAtt(0).TextString
Next
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.