.NET

Reply
Valued Contributor
stuartnathan
Posts: 70
Registered: ‎02-17-2005
Message 1 of 3 (97 Views)
Accepted Solution

Reading Attributes from event

97 Views, 2 Replies
12-05-2011 02:02 PM

Here is some code:

 

Private Sub ObjectModified(ByVal sender AsObject, ByVal e As Autodesk.AutoCAD.DatabaseServices.ObjectEventArgs)

With e.DBObject

   If .IsWriteEnabled Then Exit Sub

   If .Id.ObjectClass.Name = "AcDbAttribute"Then

       ?????

   End If    

End With

End Sub

 

Trying to read the attribute's tag and text.

Can't work out what goes in ????

 

or do I need to get the Blockreference and work through each attribute?

 

I promise I will start repaying your help soon.

Hi,

 

did you search for this?

With e.DBObject
If .IsWriteEnabled Then Exit Sub
If .Id.ObjectClass.Name = "AcDbAttribute" Then
Dim tAttRef As AttributeReference = CType(e.DBObject, AttributeReference)
Debug.Print("TAG: " & tAttRef.Tag)
Debug.Print("TXT: " & tAttRef.TextString)
Debug.Print("ObjID BlockReference: " & tAttRef.OwnerId.ToString)
End If
End With

 

 

- alfred -

*Expert Elite*
Alfred.NESWADBA
Posts: 9,212
Registered: ‎06-29-2007
Message 2 of 3 (95 Views)

Re: Reading Attributes from event

12-05-2011 02:23 PM in reply to: stuartnathan

Hi,

 

did you search for this?

With e.DBObject
  If .IsWriteEnabled Then Exit Sub
  If .Id.ObjectClass.Name = "AcDbAttribute" Then
    Dim tAttRef As AttributeReference = CType(e.DBObject, AttributeReference)
    Debug.Print("TAG: " & tAttRef.Tag)
    Debug.Print("TXT: " & tAttRef.TextString)
    Debug.Print("ObjID BlockReference: " & tAttRef.OwnerId.ToString)
  End If
End With

 

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
stuartnathan
Posts: 70
Registered: ‎02-17-2005
Message 3 of 3 (88 Views)

Re: Reading Attributes from event

12-05-2011 03:05 PM in reply to: Alfred.NESWADBA

:smileyvery-happy:Obvious really. But thanks anyway. It would have taken me a week to get there.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.