GetAttributes .NET
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
GetAttributes .NET

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
HJohn
Guest





Posted: Sat Dec 18, 2004 4:18 am    Post subject: GetAttributes .NET Reply with quote

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 Reply with quote

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 Reply with quote

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
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB