<?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: Autocad 2015 create layout in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5494292#M41471</link>
    <description>&lt;P&gt;Only just now moving to 2015.&amp;nbsp;I include in mine (not tested 2015):&lt;/P&gt;&lt;P&gt;DocumentLock doclock = doc.LockDocument();&lt;BR /&gt;...&lt;BR /&gt;doclock.Dispose();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this help? &lt;A target="_self" title="http://forums.autodesk.com/t5/net/layout-import-code-fails-in-autocad-2015/td-p/5224441" href="https://forums.autodesk.com/t5/net/layout-import-code-fails-in-autocad-2015/td-p/5224441"&gt;http://forums.autodesk.com/t5/net/layout-import-code-fails-in-autocad-2015/td-p/5224441&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Feb 2015 06:39:22 GMT</pubDate>
    <dc:creator>Dale.Bartlett</dc:creator>
    <dc:date>2015-02-04T06:39:22Z</dc:date>
    <item>
      <title>Autocad 2015 create layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5493755#M41470</link>
      <description>&lt;P&gt;I'm trying to migrate my code from 2012 to 2015. I'm having problems with a part of my code where I try to create a layout. This part is a copy of the example found here:&amp;nbsp;&lt;A target="_blank" href="http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-5FA86EF3-DEFD-4256-BB1C-56DAC32BD868"&gt;http://help.autodesk.com/&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Reference the Layout Manager
                        LayoutManager acLayoutMgr = LayoutManager.Current;

                        // Create the new layout with default settings
                        ObjectId objID = acLayoutMgr.CreateLayout("Tekstborden 1");
                        
                        // Open the layout
                        Layout acLayout = transaction.GetObject(objID, OpenMode.ForWrite) as Layout;

                        try
                        {
                            PlotSettingsValidator plotSetVal = PlotSettingsValidator.Current;
                            plotSetVal.RefreshLists(acLayout);
                            System.Collections.Specialized.StringCollection sheetList = plotSetVal.GetPlotStyleSheetList();
                            foreach (String str in sheetList)
                            {
                                if (str.ToLower().Equals("_standaard.ctb"))
                                {
                                    //find out if drawing is using ctb
                                    System.Object test = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("PSTYLEMODE");
                                    if (test.ToString().Equals("1"))
                                    {
                                        // drawing is using ctb so go ahead and
                                        //assign acad.ctb to the layout

                                        //acLayout.UpgradeOpen();
                                        plotSetVal.SetCurrentStyleSheet(acLayout, str);
                                        acLayout.DowngradeOpen();
                                    }
                                }
                            }
                        }
                        catch (Autodesk.AutoCAD.Runtime.Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This works on 2012. But on 2015 after&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ObjectId objID = acLayoutMgr.CreateLayout("Tekstborden 1");&lt;/PRE&gt;&lt;P&gt;the objID = null. The only exeption I could find while debugging is: 'ObjectLeftOnDisk = 'objID.ObjectLeftOnDisk' threw an exception of type 'System.AccessViolationException'' ;&amp;nbsp;'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone tell me whats going on?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Feb 2015 20:32:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5493755#M41470</guid>
      <dc:creator>marcwalen</dc:creator>
      <dc:date>2015-02-03T20:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Autocad 2015 create layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5494292#M41471</link>
      <description>&lt;P&gt;Only just now moving to 2015.&amp;nbsp;I include in mine (not tested 2015):&lt;/P&gt;&lt;P&gt;DocumentLock doclock = doc.LockDocument();&lt;BR /&gt;...&lt;BR /&gt;doclock.Dispose();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this help? &lt;A target="_self" title="http://forums.autodesk.com/t5/net/layout-import-code-fails-in-autocad-2015/td-p/5224441" href="https://forums.autodesk.com/t5/net/layout-import-code-fails-in-autocad-2015/td-p/5224441"&gt;http://forums.autodesk.com/t5/net/layout-import-code-fails-in-autocad-2015/td-p/5224441&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Feb 2015 06:39:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5494292#M41471</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2015-02-04T06:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Autocad 2015 create layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5494303#M41472</link>
      <description>&lt;P&gt;I already have it enclosed in:&lt;/P&gt;&lt;PRE&gt;using (Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument())
            {
                
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It doesn't seem to make any difference wether I lock the document or not. I get same result either way.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Feb 2015 06:55:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5494303#M41472</guid>
      <dc:creator>marcwalen</dc:creator>
      <dc:date>2015-02-04T06:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Autocad 2015 create layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5495290#M41473</link>
      <description>&lt;P&gt;Sounds like it may be the same problem as this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/net/need-help-programming-around-2015-api-createlayout-big/td-p/5484373" target="_self"&gt;http://forums.autodesk.com/t5/net/need-help-programming-around-2015-api-createlayout-big/td-p/5484373&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The workarounds found so far are to use COM, or to avoid accessing the layout dictionary beforehand (get layout names from the block table instead).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Feb 2015 20:18:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5495290#M41473</guid>
      <dc:creator>autodaug</dc:creator>
      <dc:date>2015-02-04T20:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Autocad 2015 create layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5495338#M41474</link>
      <description>Maybe .NET doesn't like these Dutch billboards, try "TextBoards" instead &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Could you try to copy or import a layout instead of create and then modify to you're needs. Create Layout without using the LayoutManager didn't work out very well in previous versions of AutoCAD especially when assigning Named Plot Styles.&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Feb 2015 20:49:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5495338#M41474</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2015-02-04T20:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Autocad 2015 create layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5497479#M41475</link>
      <description>&lt;P&gt;Yes, exact same problem. I managed to 'solve' this by putting the part of creating the layout in its own seperate class. Thanks all!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Feb 2015 13:21:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2015-create-layout/m-p/5497479#M41475</guid>
      <dc:creator>marcwalen</dc:creator>
      <dc:date>2015-02-06T13:21:12Z</dc:date>
    </item>
  </channel>
</rss>

