Results 1 to 6 of 6

Thread: Block Attributes

  1. #1
    Join Date
    Jan 2005
    Posts
    52

    Block Attributes

    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

  2. #2
    Join Date
    Mar 2004
    Location
    Brisbane, Australia
    Posts
    856
    Well what have you got so far ?

  3. #3
    Join Date
    Jan 2005
    Posts
    52
    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

  4. #4
    Join Date
    Jan 2005
    Posts
    52
    Ok I've obtained a selection set of my blocks, I just don't know how to access the attribute data from an AcadObject.

  5. #5
    Join Date
    Oct 2004
    Location
    Scotland
    Posts
    186
    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

  6. #6
    Join Date
    Mar 2004
    Location
    Brisbane, Australia
    Posts
    856
    Here is an example on how you could get the attributes..
    Also here is another post that may be of assistance..

    http://www.cadeverything.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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •