<?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: How to change Layer's Transparency? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3622832#M53476</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm progressing on changing layer's transparency. I noticed that transparencies are changed in the layer manager but not in the modelspace! Is there a way to refresh this? I tried REGEN and REFRESH but it doesn'twork!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;PRE&gt;'Déclaration des variables'
        acDoc = Application.DocumentManager.MdiActiveDocument
        acCurDb = acDoc.Database

        'Procédure'
        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
            acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead)

            If acLyrTbl.Has(LayerVal) = True Then
                acCurDb.Clayer = acLyrTbl(LayerVal)

                For Each acObjId As ObjectId In acLyrTbl
                    acLyrTblRec = acTrans.GetObject(acObjId, OpenMode.ForWrite)
                    If acLyrTblRec.Name &amp;lt;&amp;gt; LayerVal Then
                        acLyrTblRec.Transparency = New Autodesk.AutoCAD.Colors.Transparency(CByte(50))
                    End If
                Next (acObjId)

                acTrans.Commit()

            End If
        End Using&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This code turns the layer named layerval current, then iterate through layers collection and change their transparency if layer's name is different of Layerval.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quietly but surely!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See you!&lt;/P&gt;</description>
    <pubDate>Mon, 17 Sep 2012 18:16:04 GMT</pubDate>
    <dc:creator>MGOMKD</dc:creator>
    <dc:date>2012-09-17T18:16:04Z</dc:date>
    <item>
      <title>How to change Layer's Transparency?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3605086#M53474</link>
      <description>&lt;P&gt;Is it able to change the transparency of a layer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know how to get the value but i can't find how to set a new one!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Using acTrans = acDocs.MdiActiveDocument.Database.TransactionManager.StartTransaction()
            acLyrTbl = acTrans.GetObject(acDocs.MdiActiveDocument.Database.LayerTableId, OpenMode.ForRead)
            For Each acObjId As ObjectId In acLyrTbl
                acLyrTblRec = acTrans.GetObject(acObjId, OpenMode.ForRead)
                Dim MyTransparency As Autodesk.AutoCAD.Colors.Transparency = acLyrTblRec.Transparency
                MsgBox(MyTransparency.ToString)                
            Next acObjId&lt;BR /&gt;End Using&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Dev center is a little bit poor about it? Or I didn't it!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2012 13:38:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3605086#M53474</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2012-09-03T13:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Layer's Transparency?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3605218#M53475</link>
      <description>&lt;P&gt;See article here&lt;/P&gt;&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/autocad/2012/04/setting-layer-transparency.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/04/setting-layer-transparency.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2012 16:20:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3605218#M53475</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-03T16:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Layer's Transparency?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3622832#M53476</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm progressing on changing layer's transparency. I noticed that transparencies are changed in the layer manager but not in the modelspace! Is there a way to refresh this? I tried REGEN and REFRESH but it doesn'twork!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;PRE&gt;'Déclaration des variables'
        acDoc = Application.DocumentManager.MdiActiveDocument
        acCurDb = acDoc.Database

        'Procédure'
        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
            acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead)

            If acLyrTbl.Has(LayerVal) = True Then
                acCurDb.Clayer = acLyrTbl(LayerVal)

                For Each acObjId As ObjectId In acLyrTbl
                    acLyrTblRec = acTrans.GetObject(acObjId, OpenMode.ForWrite)
                    If acLyrTblRec.Name &amp;lt;&amp;gt; LayerVal Then
                        acLyrTblRec.Transparency = New Autodesk.AutoCAD.Colors.Transparency(CByte(50))
                    End If
                Next (acObjId)

                acTrans.Commit()

            End If
        End Using&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This code turns the layer named layerval current, then iterate through layers collection and change their transparency if layer's name is different of Layerval.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quietly but surely!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See you!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2012 18:16:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3622832#M53476</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2012-09-17T18:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Layer's Transparency?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3623034#M53477</link>
      <description>&lt;P&gt;Me too didn't solve&amp;nbsp;this issue,&amp;nbsp;sorry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2012 19:56:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3623034#M53477</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-17T19:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Layer's Transparency?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3623100#M53478</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also can reproduce the problem (AutoCAD 2012 x64 SP2 German).&lt;/P&gt;&lt;P&gt;The only way I currently found out is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;run your proc&lt;/LI&gt;&lt;LI&gt;change to any layout other than modelspace&lt;/LI&gt;&lt;LI&gt;change back to modelspace&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a bad workaround, but at least it is one &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH, - alfred -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2012 20:35:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3623100#M53478</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-09-17T20:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Layer's Transparency?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3629846#M53479</link>
      <description>&lt;P&gt;Hi friends!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I confirm, toggling from modelspace to layouts then getting back to modelspace works! But it's not the way I expected,&lt;/P&gt;&lt;P&gt;It should exist an easier one!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Go for it !!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2012 19:55:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3629846#M53479</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2012-09-21T19:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Layer's Transparency?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3642138#M53480</link>
      <description>&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By searching on the web and the .NET Developper's guide, I found a way to refresh layer after transparencies had changed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the source code:&lt;/P&gt;&lt;PRE&gt; Public Sub CurrentLayer(ByVal LayerVal)

        '************************************************************************************'
        '* Activation du calque séléctionné en calque courant et gestion de la transparence *'
        '************************************************************************************'

        'Déclaration des variables'
        acDoc = Application.DocumentManager.MdiActiveDocument
        acCurDb = acDoc.Database
        Dim acObjId As ObjectId

        'Procédure'
        Using acTrans = acCurDb.TransactionManager.StartTransaction()
            acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead)

            If acLyrTbl.Has(LayerVal) = True Then
                acCurDb.Clayer = acLyrTbl(LayerVal)
                For Each acObjId In acLyrTbl
                    acLyrTblRec = acTrans.GetObject(acObjId, OpenMode.ForWrite)
                    If acLyrTblRec.Name &amp;lt;&amp;gt; LayerVal Then
                        'Transparence du calque à 80'
                        acLyrTblRec.Transparency = New Autodesk.AutoCAD.Colors.Transparency(CByte(50))
                    Else
                        'Transparence du calque à 0'
                        acLyrTblRec.Transparency = New Autodesk.AutoCAD.Colors.Transparency(CByte(255))
                    End If
                Next (acObjId)
            End If

            'Application des changements'
            acTrans.Commit()

            'Déclaration variable et appel de fonction'
            Dim acLyrTblIds As ObjectIdCollection = GetLayerObjectIds()

            'Itération sur les calques dans la collection'
            Dim acLyrTblId(acLyrTblIds.Count - 1) As ObjectId
            For i = 0 To acLyrTblIds.Count - 1
                acLyrTblId(i) = acLyrTblIds(i)
            Next

            'Regénération des calques'
            Autodesk.AutoCAD.Internal.LayerUtilities.RegenLayers(acLyrTblId, Autodesk.AutoCAD.Internal.LayerUtilities.RegenPending)

        End Using

    End Sub

    Function GetLayerObjectIds() As ObjectIdCollection

        '****************************************************'
        '* Création du stockage de la collection de calques *'
        '****************************************************'

        'Déclaration variable'
        Dim acLyrTblIds As New ObjectIdCollection

        'Procédure'
        Using acTrans = acCurDb.TransactionManager.StartTransaction()
            acLyrTbl = acCurDb.LayerTableId.GetObject(OpenMode.ForWrite)

            'Création de la collection de calques'
            For Each acObjId In acLyrTbl
                acLyrTblIds.Add(acObjId)
            Next

            'Application des changements'
            acTrans.Commit()
        End Using

        'Renvoi du résultat'
        Return acLyrTblIds

    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;See you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2012 08:13:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-change-layer-s-transparency/m-p/3642138#M53480</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2012-10-02T08:13:55Z</dc:date>
    </item>
  </channel>
</rss>

