Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear:
The following code attempts to delete a layout of a closed drawing. In the procedure, lines down, give like data file path and should result in me a copy of this least Layout indicated. In the picture you can see that does not eliminate the Layotu if not rather renames. there is something wrong that I'm doing in my code?
Thank you
Private Sub datosLyDWg(ByVal FileDWG As String) Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Using doc.LockDocument Dim dbFuente As New Database(False, True) Using dbFuente dbFuente.ReadDwgFile(FileDWG, System.IO.FileShare.ReadWrite, False, Nothing) Dim NombreDibujo As String = System.IO.Path.GetFileName(FileDWG) Using tr As Transaction = dbFuente.TransactionManager.StartTransaction Dim layoutDicc As DBDictionary = TryCast(tr.GetObject(dbFuente.LayoutDictionaryId, OpenMode.ForRead, False), DBDictionary) For Each entrada As DBDictionaryEntry In layoutDicc Dim layoutId As ObjectId = entrada.Value Dim layout As Layout = TryCast(tr.GetObject(layoutId, OpenMode.ForWrite), Layout) If Not layout.LayoutName.Equals("Model") Then If layout.LayoutName.Equals("1800A") Then layout.Erase() End If End If Next dbFuente.SaveAs("D:\TEST_SHEEP-SET\Test\Exit\1800A.dwg", DwgVersion.Current) End Using End Using End Using End Sub
Solved! Go to Solution.