.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading Attributes from event

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
stuartnathan
287 Views, 2 Replies

Reading Attributes from event

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.

2 REPLIES 2
Message 2 of 3

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 ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 3

Smiley Very HappyObvious really. But thanks anyway. It would have taken me a week to get there.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost