.NET

Reply
*Rune Aarnes
Message 1 of 1 (36 Views)

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

36 Views, 0 Replies
01-24-2006 10:50 AM
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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community