I am trying to write code to change all the mleader styles called "Standard" to a new mleader called "New Style"
There are at least two problems with my code.
The first is that "Xrecord" is not a member of "db.MLeaderStyleDictionaryId"
The second is that "MleaderStyleName" is not valid
What Changes do I need to make?
<CommandMethod("changeLeaderStyle")> _
Public Sub ChangeDimStyle()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Using trx As Transaction = db.TransactionManager.StartTransaction()
Dim mldict As DBDictionary = DirectCast(trx.GetObject(db.MLeaderStyleDictionaryId, OpenMode.ForRead), DBDictionary)
Dim mtr As Xrecord = trx.GetObject(mldict("Standard"), OpenMode.ForRead)
Dim ids As ObjectIdCollection = mldict.GetPersistentReactorIds()
For Each objId As ObjectId In ids
If objId.ObjectClass.IsDerivedFrom(RXClass.GetClass(GetType(MLeaderStyle))) Then
Dim mldr As MLeaderStyle = trx.GetObject(objId, OpenMode.ForWrite)
mldr.MleaderStylename = "New style"
End If
Next
trx.Commit()
End Using
End Sub