| Author |
Message |
HJohn
Guest
|
Posted:
Sat Dec 18, 2004 4:18 am Post subject:
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.
|
|
| Back to top |
|
 |
Mike Tuersley
Guest
|
Posted:
Sat Dec 18, 2004 11:43 am Post subject:
Re: GetAttributes .NET |
|
|
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... |
|
| Back to top |
|
 |
HJohn
Guest
|
Posted:
Mon Dec 20, 2004 7:35 pm Post subject:
Re: GetAttributes .NET |
|
|
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?
|
|
| Back to top |
|
 |
|
|
|
|