<?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: Programmatically locked layers won't fade in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/programmatically-locked-layers-won-t-fade/m-p/2450712#M71368</link>
    <description>You have to set the LAYLOCKFADECTL after you're through modifying the layers...no way around it.</description>
    <pubDate>Thu, 19 Mar 2009 12:24:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-03-19T12:24:38Z</dc:date>
    <item>
      <title>Programmatically locked layers won't fade</title>
      <link>https://forums.autodesk.com/t5/net-forum/programmatically-locked-layers-won-t-fade/m-p/2450711#M71367</link>
      <description>I have the following sub:&lt;BR /&gt;
{code}&lt;BR /&gt;
''' (summary) Locks or unlocks all layers in the drawing (summary)&lt;BR /&gt;
    ''' (param name="Lock") Set to True if layers are to be locked or False to unlock (/param)&lt;BR /&gt;
    ''' (remarks) If locking, the current layer is left unlocked (/remarks)&lt;BR /&gt;
    Public Sub LockLayers(ByVal Lock As Boolean)&lt;BR /&gt;
        Dim db As Database = HostApplicationServices.WorkingDatabase&lt;BR /&gt;
        Using trans As Transaction = db.TransactionManager.StartTransaction&lt;BR /&gt;
            Dim lt As LayerTable = trans.GetObject(db.LayerTableId, OpenMode.ForWrite)&lt;BR /&gt;
            For Each objID As ObjectId In lt&lt;BR /&gt;
                Dim ltr As LayerTableRecord = trans.GetObject(objID, OpenMode.ForRead)&lt;BR /&gt;
                Dim curLayer As ObjectId = db.Clayer&lt;BR /&gt;
                If curLayer &amp;lt;&amp;gt; objID Then&lt;BR /&gt;
                    ltr.UpgradeOpen()&lt;BR /&gt;
                    ltr.IsLocked = Lock&lt;BR /&gt;
                End If&lt;BR /&gt;
            Next&lt;BR /&gt;
            trans.Commit()&lt;BR /&gt;
        End Using&lt;BR /&gt;
    End Sub&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
It works fine and locks all the layers (except the current one) but the locked layers don't fade out as they do when it's done through the layer manager. &lt;BR /&gt;
I can get them to fade if I set the LAYLOCKFADECTL system variable but i can't then get them to "un-fade" when they're unlocked using the same method.&lt;BR /&gt;
I'd rather not have to set the system variable anyway.&lt;BR /&gt;
&lt;BR /&gt;
I've tried regen and updatescreen but no joy.&lt;BR /&gt;
&lt;BR /&gt;
Is there something else I need to update/refresh to get them to grey-out properly?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Thu, 19 Mar 2009 10:40:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/programmatically-locked-layers-won-t-fade/m-p/2450711#M71367</guid>
      <dc:creator>Paulio</dc:creator>
      <dc:date>2009-03-19T10:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically locked layers won't fade</title>
      <link>https://forums.autodesk.com/t5/net-forum/programmatically-locked-layers-won-t-fade/m-p/2450712#M71368</link>
      <description>You have to set the LAYLOCKFADECTL after you're through modifying the layers...no way around it.</description>
      <pubDate>Thu, 19 Mar 2009 12:24:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/programmatically-locked-layers-won-t-fade/m-p/2450712#M71368</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-03-19T12:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically locked layers won't fade</title>
      <link>https://forums.autodesk.com/t5/net-forum/programmatically-locked-layers-won-t-fade/m-p/12325276#M71369</link>
      <description>&lt;P&gt;I've worked out that for unlocking you can toggle the LAYLOCKFADECTL off and on to&amp;nbsp; give the drawing a kick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim int As Integer = Application.GetSystemVariable("LAYLOCKFADECTL")
Application.SetSystemVariable("LAYLOCKFADECTL", 0)
Application.SetSystemVariable("LAYLOCKFADECTL", int)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 19:08:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/programmatically-locked-layers-won-t-fade/m-p/12325276#M71369</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2023-10-23T19:08:02Z</dc:date>
    </item>
  </channel>
</rss>

