<?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 Viewport Layer Freeze Display Issue in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/viewport-layer-freeze-display-issue/m-p/3751759#M51606</link>
    <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;The following code freezes LayerId in all viewports in all&amp;nbsp;layouts except for LayoutToSkip. This all works well except for the fact that the layers do not correctly display, ie they all remain visible in all viewports. When I check the viewport layer settings they are all correct. If the drawing is saved, closed, and re-opened, then the layers correctly display. As you can see, I have tried vp.UpdateDisplay() and ed.UpdateTiledViewportsFromDatabase() which have no effect. Manually trying regen or regenall does not correct the display. Any thoughts? Thanks, Dale&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;// this works, but the display is not correct until dwg is re-opened&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;static &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; LayerFreezeAllViewports(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; pLayerId, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;string &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;pstrLayoutToSkip)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; doc = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;AcadApp&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Editor&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;ed = doc.Editor;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;db = doc.Database;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Transaction &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;tr&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; = db.TransactionManager.StartTransaction())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;[] ids = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;new &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;[1] { pLayerId };&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;DBDictionary&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; layoutDict = tr.GetObject(db.LayoutDictionaryId, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.ForRead) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;as &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;DBDictionary&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// get current layout&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; lstrCurrentLayout = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;LayoutManager&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.Current.CurrentLayout;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;DBDictionaryEntry&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; entry &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;layoutDict)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(entry.Key.ToUpper() != &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas"&gt;&lt;FONT color="#a31515" face="Consolas"&gt;&lt;FONT color="#a31515" face="Consolas"&gt;"MODEL"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Layout&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; lay = tr.GetObject(entry.Value, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Layout&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// new layouts must be initialised -&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;done at create&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;//if(lay.LayoutName.ToUpper() != lstrCurrentLayout.ToUpper())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;//&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;setCurrentLayoutTab(lay.LayoutName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// check for layout matching&amp;nbsp;param to leave layers on&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(lay.LayoutName.ToUpper() != pstrLayoutToSkip)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; vpId &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;lay.GetViewports())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Viewport&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; vp = tr.GetObject(vpId, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Viewport&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;vp.FreezeLayersInViewport(ids.GetEnumerator());&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// DESPERATE TRY&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;vp.UpdateDisplay();&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// ??? save/close/open and all is correct&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;}}}}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// ed.UpdateTiledViewportsFromDatabase();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;</description>
    <pubDate>Sun, 13 Jan 2013 05:09:07 GMT</pubDate>
    <dc:creator>Dale.Bartlett</dc:creator>
    <dc:date>2013-01-13T05:09:07Z</dc:date>
    <item>
      <title>Viewport Layer Freeze Display Issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-layer-freeze-display-issue/m-p/3751759#M51606</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;The following code freezes LayerId in all viewports in all&amp;nbsp;layouts except for LayoutToSkip. This all works well except for the fact that the layers do not correctly display, ie they all remain visible in all viewports. When I check the viewport layer settings they are all correct. If the drawing is saved, closed, and re-opened, then the layers correctly display. As you can see, I have tried vp.UpdateDisplay() and ed.UpdateTiledViewportsFromDatabase() which have no effect. Manually trying regen or regenall does not correct the display. Any thoughts? Thanks, Dale&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;// this works, but the display is not correct until dwg is re-opened&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;static &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; LayerFreezeAllViewports(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; pLayerId, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;string &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;pstrLayoutToSkip)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; doc = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;AcadApp&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Editor&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;ed = doc.Editor;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;db = doc.Database;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Transaction &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;tr&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; = db.TransactionManager.StartTransaction())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;[] ids = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;new &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;[1] { pLayerId };&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;DBDictionary&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; layoutDict = tr.GetObject(db.LayoutDictionaryId, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.ForRead) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;as &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;DBDictionary&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// get current layout&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; lstrCurrentLayout = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;LayoutManager&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.Current.CurrentLayout;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;DBDictionaryEntry&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; entry &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;layoutDict)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(entry.Key.ToUpper() != &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas"&gt;&lt;FONT color="#a31515" face="Consolas"&gt;&lt;FONT color="#a31515" face="Consolas"&gt;"MODEL"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Layout&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; lay = tr.GetObject(entry.Value, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Layout&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// new layouts must be initialised -&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;done at create&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;//if(lay.LayoutName.ToUpper() != lstrCurrentLayout.ToUpper())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;//&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;setCurrentLayoutTab(lay.LayoutName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// check for layout matching&amp;nbsp;param to leave layers on&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(lay.LayoutName.ToUpper() != pstrLayoutToSkip)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; vpId &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;lay.GetViewports())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Viewport&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt; vp = tr.GetObject(vpId, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;&lt;FONT color="#0000ff" face="Consolas"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;&lt;FONT color="#2b91af" face="Consolas"&gt;Viewport&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;&lt;FONT face="Consolas"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;vp.FreezeLayersInViewport(ids.GetEnumerator());&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// DESPERATE TRY&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;vp.UpdateDisplay();&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// ??? save/close/open and all is correct&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;}}}}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;&lt;FONT color="#008000" face="Consolas"&gt;// ed.UpdateTiledViewportsFromDatabase();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jan 2013 05:09:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-layer-freeze-display-issue/m-p/3751759#M51606</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2013-01-13T05:09:07Z</dc:date>
    </item>
    <item>
      <title>Re : Viewport Layer Freeze Display Issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-layer-freeze-display-issue/m-p/3751796#M51607</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IMHO, this is not due to your code but to the current value of LAYOUTREGENCTRL while switching between tabs after you run your code.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jan 2013 10:00:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-layer-freeze-display-issue/m-p/3751796#M51607</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-01-13T10:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Viewport Layer Freeze Display Issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-layer-freeze-display-issue/m-p/3752105#M51608</link>
      <description>&lt;P&gt;Thanks, I'll try that.&lt;/P&gt;&lt;P&gt;Regards, Dale&lt;/P&gt;&lt;P&gt;nb LAYOUTREGENCTL (not CTRL)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2013 07:00:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-layer-freeze-display-issue/m-p/3752105#M51608</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2013-01-14T07:00:16Z</dc:date>
    </item>
  </channel>
</rss>

