<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re : Remove Layout in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/remove-layout/m-p/5826714#M38604</link>
    <description>&lt;P&gt;Thanks Dear, now able to continue with the application without changing course.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Sep 2015 23:39:59 GMT</pubDate>
    <dc:creator>ccalvo12</dc:creator>
    <dc:date>2015-09-21T23:39:59Z</dc:date>
    <item>
      <title>Remove Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/remove-layout/m-p/5824050#M38602</link>
      <description>&lt;P&gt;Dear:&lt;BR /&gt;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?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Sep 2015 23:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/remove-layout/m-p/5824050#M38602</guid>
      <dc:creator>ccalvo12</dc:creator>
      <dc:date>2015-09-18T23:59:14Z</dc:date>
    </item>
    <item>
      <title>Re : Remove Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/remove-layout/m-p/5824156#M38603</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example using the target databse LayoutManager:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        private string DeleteLayout(string fileName, string layoutName)
        {
            Database currentDatabase = HostApplicationServices.WorkingDatabase;
            try
            {
                using (Database targetDatabase = new Database(false, true))
                {
                    targetDatabase.ReadDwgFile(fileName, System.IO.FileShare.ReadWrite, false, null);
                    HostApplicationServices.WorkingDatabase = targetDatabase;
                    LayoutManager lm = LayoutManager.Current;
                    lm.DeleteLayout(layoutName);
                    targetDatabase.SaveAs(fileName, DwgVersion.Current);
                }
                return "Delete layout succeeded";
            }
            catch (System.Exception ex)
            {
                return "\nDelete layout failed: " + ex.Message;
            }
            finally
            {
                HostApplicationServices.WorkingDatabase = currentDatabase;
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Sep 2015 06:57:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/remove-layout/m-p/5824156#M38603</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2015-09-19T06:57:57Z</dc:date>
    </item>
    <item>
      <title>Re : Remove Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/remove-layout/m-p/5826714#M38604</link>
      <description>&lt;P&gt;Thanks Dear, now able to continue with the application without changing course.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 23:39:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/remove-layout/m-p/5826714#M38604</guid>
      <dc:creator>ccalvo12</dc:creator>
      <dc:date>2015-09-21T23:39:59Z</dc:date>
    </item>
  </channel>
</rss>

