Results 1 to 3 of 3

Thread: GetAttributes .NET

  1. #1
    HJohn Guest

    GetAttributes .NET

    I am trying to retrieve attributes using ObjectDBX and .NET, but I am getting an error. I am using this:

    Dim Blk as AXDBLib.AcadBlockReference
    Dim Att as Object

    Att=Blk.GetAttributes

    This returns a system array {system._ComObject}, my error is in trying to access each attribute from the array. Can someone give me a hand, I would really appreciate it.

  2. #2
    Mike Tuersley Guest
    Since it returns an array, you need to give it one:

    Dim oAtts() As Object
    'get the blocks attributes
    oAtts = oBlkRef.GetAttributes

    Then you can either use a classic FOR loop:

    Dim oAtt As AcadAttributeReference
    Dim iCntr As Integer
    'iterate the attributes
    For iCntr = oAtts.GetLowerBound(0) To oAtts.GetUpperBound(0)
    ....do your work....
    Next

    Or you can use a FOR EACH loop:

    Dim oAtt As AcadAttributeReference
    'iterate the attributes
    For Each oAtt In oAtts
    ....do your work....
    Next


    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...

  3. #3
    HJohn Guest
    Thanks Mike. I was doing that, but I was stopping just after assigning the first element of the array to the att variable. In the local window it doesn't show the content of the att obj. as in vba, it just shows {system._comobject} and nothing else, so I though it was an error. With your confirmation I continued and printed the textstrings to the console and it worked fine, so thanks again. Is it just my computer or is it that .NET doesn't display the contents of the attributes on the local window?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other forums: Access Forum - Microsoft Office Forum - Exchange Server Forum