What's the error?
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message
news:6272805@discussion.autodesk.com...
I tried -> sub2Dict.SetName(strOld, strNew) in the following sub but I
error out. Is this the way it is to be used?
Thanks.
Chris
Public Sub RenameCategory(ByVal strOld As String, ByVal strNew As
String)
Dim ed As Editor =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
'get working database
Dim dwg As Database = ed.Document.Database
Using trans As Transaction =
dwg.TransactionManager.StartTransaction()
Try
Dim NOD As DBDictionary =
CType(trans.GetObject(dwg.NamedObjectsDictionaryId, OpenMode.ForWrite),
DBDictionary)
Dim MainDict As DBDictionary =
CType(trans.GetObject(NOD.GetAt("PH_Dictionaries"), OpenMode.ForWrite),
DBDictionary)
Dim sub1Dict As DBDictionary =
CType(trans.GetObject(MainDict.GetAt("PH_Revisions"), OpenMode.ForWrite),
DBDictionary)
Dim sub2Dict As DBDictionary =
CType(trans.GetObject(sub1Dict.GetAt(strOld), OpenMode.ForWrite),
DBDictionary)
sub2Dict.SetName(strOld, strNew)
trans.Commit()
Catch caught As System.Exception
MessageBox.Show(caught.StackTrace)
End Try
End Using
End Sub