<?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: Extra Layer Names When Importing a Layout From a Template in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3529980#M54687</link>
    <description>&lt;P&gt;Looking real quick at your WblockCloneObjects call your DuplicateRecordCloning argument is set to DuplicateRecordCloning.MangleName.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From docs&lt;/P&gt;&lt;PRE&gt;MangleName -&amp;nbsp; Mangle all the incoming record names using $0$  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jul 2012 22:58:23 GMT</pubDate>
    <dc:creator>jeff</dc:creator>
    <dc:date>2012-07-06T22:58:23Z</dc:date>
    <item>
      <title>Extra Layer Names When Importing a Layout From a Template</title>
      <link>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3529970#M54686</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;When I manually add a new layout from a template, I do NOT get any extra layers, but when I use VB to do the same thing, I get extra layers.&lt;/P&gt;&lt;P&gt;In the original drawing, I have layers called "SHEET", "TEXT", and "VIEWPORT" (among other layers).&lt;/P&gt;&lt;P&gt;In the template where I get my new layout, I also have the same layer names ("SHEET", "TEXT", and "VIEWPORT").&lt;/P&gt;&lt;P&gt;After the new layout gets read in, I now have extra layers called "$0$SHEET", "$0$TEXT", and "$0$VIEWPORT".&amp;nbsp; Why does this happen using VB, but not when I do it manually?&amp;nbsp; Is there anything I can do to the code to change this?&amp;nbsp; I understand the layer names are the same, but they're the same whether I do it manually or by code.&lt;/P&gt;&lt;PRE&gt;    Public Function importLayout(ByVal templateFileName As String, ByVal templateLayoutName As String) As ObjectId
        Dim idLayout As ObjectId = ObjectId.Null
        Dim doc As Document = Application.DocumentManager.MdiActiveDocument
        Dim ed As Editor = doc.Editor
        Dim oLock As DocumentLock = doc.LockDocument()
        Dim dbSource As New Database(False, False)
        Dim db As Database = HostApplicationServices.WorkingDatabase
        Dim templateTrans As Transaction = db.TransactionManager.StartTransaction()
        Try
            dbSource.ReadDwgFile(templateFileName, System.IO.FileShare.Read, True, Nothing)
            Dim idDbdSource As ObjectId = dbSource.LayoutDictionaryId
            Dim layoutDictionary As DBDictionary = DirectCast(templateTrans.GetObject(idDbdSource, OpenMode.ForRead, False, False), DBDictionary)

            For Each deLayout As DictionaryEntry In layoutDictionary
                Dim sLayout As String = deLayout.Key.ToString()
                If sLayout.ToUpper() = templateLayoutName.ToUpper() Then
                    idLayout = DirectCast(deLayout.Value, ObjectId)
                    Exit For
                End If
            Next
            If idLayout &amp;lt;&amp;gt; ObjectId.Null Then
                Dim idc As New ObjectIdCollection()
                idc.Add(idLayout)
                Dim idMap As IdMapping = New IdMapping()
                Dim dbdict As DBDictionary = DirectCast(templateTrans.GetObject(db.LayoutDictionaryId, OpenMode.ForRead, False, False), DBDictionary)
                dbdict.UpgradeOpen()
                db.WblockCloneObjects(idc, db.LayoutDictionaryId, idMap, DuplicateRecordCloning.MangleName, False)
                Dim ip As IdPair = idMap.Lookup(idLayout)
                idLayout = ip.Value
                Dim layoutMgr As LayoutManager = LayoutManager.Current
                layoutMgr.CurrentLayout = templateLayoutName
                dbdict.DecomposeForSave(DwgVersion.Current)
                ed.Regen()
            End If
            templateTrans.Commit()
        Catch ex As Autodesk.AutoCAD.Runtime.Exception
            MsgBox(ex.StackTrace)
        Finally
            templateTrans.Dispose()
            dbSource.Dispose()
            oLock.Dispose()
        End Try
        Return idLayout
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2012 22:36:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3529970#M54686</guid>
      <dc:creator>mgorecki</dc:creator>
      <dc:date>2012-07-06T22:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extra Layer Names When Importing a Layout From a Template</title>
      <link>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3529980#M54687</link>
      <description>&lt;P&gt;Looking real quick at your WblockCloneObjects call your DuplicateRecordCloning argument is set to DuplicateRecordCloning.MangleName.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From docs&lt;/P&gt;&lt;PRE&gt;MangleName -&amp;nbsp; Mangle all the incoming record names using $0$  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2012 22:58:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3529980#M54687</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2012-07-06T22:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extra Layer Names When Importing a Layout From a Template</title>
      <link>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3531492#M54688</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&amp;nbsp; That did the trick.&amp;nbsp; Where can I find out info like this?&amp;nbsp; I looked in &lt;A target="_blank" href="http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html"&gt;http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html&lt;/A&gt;, but I didn't see where it broke the command down to include the arguments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2012 17:17:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3531492#M54688</guid>
      <dc:creator>mgorecki</dc:creator>
      <dc:date>2012-07-09T17:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Extra Layer Names When Importing a Layout From a Template</title>
      <link>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3531508#M54689</link>
      <description>&lt;P&gt;Look inside the ObjectArx docs folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The arxmgd.chm is the .NET API but I would strongly suggest using the arxdoc.chm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The arxdoc.chm contains the arxmgd.chm&amp;nbsp; but contains the ObjectARX developers guide that has&amp;nbsp;alot of useful information to give some deeper explanations on what the .NET API in end is using.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2012 17:28:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3531508#M54689</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2012-07-09T17:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extra Layer Names When Importing a Layout From a Template</title>
      <link>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3531832#M54690</link>
      <description>&lt;P&gt;Thanks for the info.&amp;nbsp; I've made a shortcut to it on my desktop.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2012 20:05:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/extra-layer-names-when-importing-a-layout-from-a-template/m-p/3531832#M54690</guid>
      <dc:creator>mgorecki</dc:creator>
      <dc:date>2012-07-09T20:05:37Z</dc:date>
    </item>
  </channel>
</rss>

