Hi All,
Please let me know this error:
When I try the code:
Public Sub HVP() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim ed As Editor = doc.Editor Dim db As Database = HostApplicationServices.WorkingDatabase Using DocLock As DocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument() Using tr As Transaction = db.TransactionManager.StartTransaction() Try Dim layoutdict As DBDictionary = TryCast(tr.GetObject(db.LayoutDictionaryId, OpenMode.ForRead, False, True), DBDictionary) For Each entry As DBDictionaryEntry In layoutdict If entry.Key <> "Model" Then Dim lay As Layout = TryCast(tr.GetObject(entry.Value, OpenMode.ForRead, False, True), Layout) For Each vpid As ObjectId In lay.GetViewports() Dim vp As Autodesk.AutoCAD.DatabaseServices.Viewport = TryCast(tr.GetObject(vpid, OpenMode.ForWrite, True, True), Autodesk.AutoCAD.DatabaseServices.Viewport) vp.On = False Next End If Next Catch ex As Exception MsgBox(ex.Message & ex.StackTrace & ex.ErrorStatus) End Try tr.Commit() End Using End Using
Thanks for any help.