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

How to put a new value in a block with attributs?

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
150 Views, 0 Replies

How to put a new value in a block with attributs?

Do anybody know what is wrong with this codesegment.
I try to put some new value in attributes in a block I pick in a drawing...
I am new in vb.net...


Dim db As Database = HostApplicationServices.WorkingDatabase
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager =
db.TransactionManager
Dim trans As Autodesk.AutoCAD.DatabaseServices.Transaction =
tm.StartTransaction

Try
Dim blkRef As BlockReference
blkRef = trans.GetObject(m_blockId, OpenMode.ForRead)
Dim attRibCol As AttributeCollection
attRibCol = blkRef.AttributeCollection()
Dim attributtID As ObjectId

For Each attributtID In attRibCol
Dim attributtRef As AttributeReference
attributtRef = trans.GetObject(attributtID, OpenMode.ForWrite,
False)
attributtRef.TextString = "someValue"
Next

trans.Commit() 'THIS IS WRONG MAY BE.....

Catch ex As Exception
MessageBox.Show(ex.Message)
trans.Abort()
Finally
If (Not trans Is Nothing) Then
trans.Dispose()
End If
End Try



thanks
Rune Aarnes
0 REPLIES 0

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