Attribute Tag Value

Discussion in 'AutoCAD' started by simplytar, Aug 25, 2003.

  1. simplytar

    simplytar Guest

    I am trying to change the value of an attribute tag and I am having problems. Situation: I want to take the text string out of a text box and put that value into an EXISTING block in a drawing. The problem I am having is that I can't do this with out inserting the block first with in the same sub routine; the issue is, is that the block is already in the drawing and I don't want to reinsert it?!? I am thinking this can't be done; meaning, to gain access to a tag's value you must code the block's insertion within the same sub routine.
    ie: object.GetAttributes Doesn't seem to work on existing blocks in a drawing. (unless you just inserted it in the sub routine)

    Any help would be appreciated!
    Thanks,
    -t
     
    simplytar, Aug 25, 2003
    #1
  2. simplytar

    Eric Stewart Guest

    Interesting timing. This morning I created a simple routine to copy
    attributes form one block to another block. Of course both blocks have the
    sma enumber of attributes and in the same order. Take a look at what I did
    and adjust it for your needs.

    Dim CurrBlk As AcadBlockReference
    Dim CurrAtts As Variant

    ThisDrawing.Utility.GetEntity CurrBlk, pt, "Pick block to copy attributes
    from"
    CurrAtts = CurrBlk.GetAttributes

    Dim NewBlk As AcadBlockReference
    Dim NewAtts As Variant

    ThisDrawing.Utility.GetEntity NewBlk, pt, "Pick block to copy attributes to"
    NewAtts = NewBlk.GetAttributes

    NewAtts(0).TextString = CurrAtts(0).TextString
    NewAtts(1).TextString = CurrAtts(1).TextString


    HTH
     
    Eric Stewart, Aug 25, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.