Passing on attribute info

Discussion in 'AutoCAD' started by Arnoud, Dec 24, 2003.

  1. Arnoud

    Arnoud Guest

    I've created a context menu item in POP515:

    ID_Att_Info [&Attribuut info]^C^C-vbarun "UmmSearch (var as string)"

    I would like to pass on the attribute textstrings of the selected item to a procedure "Ummsearch ( var as string)"

    I have tried some things in VLisp (entget, ssget etc) but when selecting a blockreference, all I get is the block data and not the attribute data.

    Any ideas?
     
    Arnoud, Dec 24, 2003
    #1
  2. Arnoud

    ECCAD Guest

    Here is how to extract Attribute(s).
    Public Function Get_Attr (str_Block, str_Attr) As String
    Dim intItems As Integer
    Dim MyBlock As AcadBlockReference
    str_Attr = "?"
    With ThisDrawing.ModelSpace
    For intItems = 0 to ThisDrawing.ModelSpace.count - 1
    If .Item(intItems).EntityType = acBlockReference Then
    Set MyBlock = .Item(intItems)
    If str_Block = MyBlock.Name Then
    str_Attr = MyBlock.GetAttributes(0).TextString
    Exit For
    End If
    End If
    Next intItems
    End With
    Return str_Attr
    End Function
    --------------
    Cheers

    Bob Shaw
    (www.bobscadshop.com)
     
    ECCAD, Dec 24, 2003
    #2
  3. Design the procedure *not* to accept the string as an argument, but rather
    use the Utility object's GetString method to ask for the string, and pass
    that via the macro:

    ^C^C-vbarun;UmmSearch;MyString


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | I've created a context menu item in POP515:
    |
    | ID_Att_Info [&Attribuut info]^C^C-vbarun "UmmSearch (var as string)"
    |
    | I would like to pass on the attribute textstrings of the selected item to
    a procedure "Ummsearch ( var as string)"
    |
    | I have tried some things in VLisp (entget, ssget etc) but when selecting a
    blockreference, all I get is the block data and not the attribute data.
    |
    | Any ideas?
     
    R. Robert Bell, Dec 30, 2003
    #3
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.