<?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: C# to access the setup for the Layer Translator in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7071556#M31700</link>
    <description>&lt;P&gt;Thanks for the assist Madhukar&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2017 12:01:30 GMT</pubDate>
    <dc:creator>dennis</dc:creator>
    <dc:date>2017-05-09T12:01:30Z</dc:date>
    <item>
      <title>C# to access the setup for the Layer Translator</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7061366#M31698</link>
      <description>&lt;P&gt;Can someone confirm whether this is possible, to access the Layer Translator setup in a DWS file.&amp;nbsp; I suspect the translation is stored in a Dictionary, and if so, then could it be accessed and modified via code, such as C#.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 13:02:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7061366#M31698</guid>
      <dc:creator>dennis</dc:creator>
      <dc:date>2017-05-04T13:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: C# to access the setup for the Layer Translator</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7070890#M31699</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I understand correctly, you would like access (r\w) the mapping information between layers in translation, the information is stored in DWS under AcStPlugin dictionary, AcStLay.AcStLayer2 &amp;nbsp;which is a AcDbXRecord. ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure if we can retrieve the information, there is Activex lib for this AcStMgr.tlb, I'm investigating on this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will get back to you if I find any further information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2017 06:15:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7070890#M31699</guid>
      <dc:creator>moogalm</dc:creator>
      <dc:date>2017-05-09T06:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: C# to access the setup for the Layer Translator</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7071556#M31700</link>
      <description>&lt;P&gt;Thanks for the assist Madhukar&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2017 12:01:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7071556#M31700</guid>
      <dc:creator>dennis</dc:creator>
      <dc:date>2017-05-09T12:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: C# to access the setup for the Layer Translator</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7073964#M31701</link>
      <description>&lt;P&gt;Dennis, thank you for your patience&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LayerTranslationMappings are stored in XDATA of each layer in DWS, DWS is same as DWG with different extension, readDWG API you can change Layer properties.(Thanks to lee from ACAD Documentation team for the tip)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The mappings can retrieved as following.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the attached DWS, following is the output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LAYER TRANSLATION MAPPING:&lt;BR /&gt;A:1&lt;BR /&gt;B:2&lt;BR /&gt;C:3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE style="color: #d1d1d1; background: #000000;"&gt;&lt;SPAN style="color: #e66170; font-weight: bold;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;static&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;void&lt;/SPAN&gt; tstreadDws&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;
        &lt;SPAN style="color: #b060b0;"&gt;{&lt;/SPAN&gt;
            &lt;SPAN style="color: #9999a9;"&gt;// save old database&lt;/SPAN&gt;
            Database oldDb &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; HostApplicationServices&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;WorkingDatabase&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
            Editor ed &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; Application&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;DocumentManager&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;MdiActiveDocument&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;Editor&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;

            &lt;SPAN style="color: #9999a9;"&gt;// when using ReadDwgFile, never specify True to buildDefaultDwg&lt;/SPAN&gt;
            &lt;SPAN style="color: #9999a9;"&gt;// also, set noDocument=True because this drawing has no&lt;/SPAN&gt;
            &lt;SPAN style="color: #9999a9;"&gt;// AutoCAD Document associated with it&lt;/SPAN&gt;
            &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;using&lt;/SPAN&gt; &lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;Database db &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;new&lt;/SPAN&gt; Database&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #e66170; font-weight: bold;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;true&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;
            &lt;SPAN style="color: #b060b0;"&gt;{&lt;/SPAN&gt;
                db&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;ReadDwgFile&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #00c4c4;"&gt;D:\\Temp\\MyStandard.dws&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;,&lt;/SPAN&gt; FileOpenMode&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;OpenForReadAndWriteNoShare&lt;SPAN style="color: #d2cd86;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;true&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                &lt;SPAN style="color: #9999a9;"&gt;// closing the input makes sure the whole dwg is read from disk&lt;/SPAN&gt;
                &lt;SPAN style="color: #9999a9;"&gt;// it also closes the file so you can SaveAs the same name&lt;/SPAN&gt;
                db&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;CloseInput&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #e66170; font-weight: bold;"&gt;true&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;string&lt;/SPAN&gt; appName &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #00c4c4;"&gt;ACLAYTRANS&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;               
                &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;string&lt;/SPAN&gt; msg &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #00c4c4;"&gt;LAYER TRANSLATION MAPPING:\n&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;

                &lt;SPAN style="color: #9999a9;"&gt;// ok time to set the working database&lt;/SPAN&gt;

                HostApplicationServices&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;WorkingDatabase &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; db&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;using&lt;/SPAN&gt; &lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;Transaction t &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; db&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;TransactionManager&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;StartTransaction&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;
                &lt;SPAN style="color: #b060b0;"&gt;{&lt;/SPAN&gt;
                    LayerTable lt &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; t&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;GetObject&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;db&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;LayerTableId&lt;SPAN style="color: #d2cd86;"&gt;,&lt;/SPAN&gt; OpenMode&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;ForRead&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;as&lt;/SPAN&gt; LayerTable&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                    &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;foreach&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;ObjectId oId &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;in&lt;/SPAN&gt; lt&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;
                    &lt;SPAN style="color: #b060b0;"&gt;{&lt;/SPAN&gt;
                        LayerTableRecord ltr &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; t&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;GetObject&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;oId&lt;SPAN style="color: #d2cd86;"&gt;,&lt;/SPAN&gt; OpenMode&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;ForRead&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;as&lt;/SPAN&gt; LayerTableRecord&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                        
                        ResultBuffer rb &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; ltr&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;GetXDataForApplication&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;appName&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                        &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;rb &lt;SPAN style="color: #d2cd86;"&gt;!&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;null&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;
                        &lt;SPAN style="color: #b060b0;"&gt;{&lt;/SPAN&gt;
                            &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;string&lt;/SPAN&gt; layerName &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; ltr&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;Name&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                            &lt;SPAN style="color: #9999a9;"&gt;// Get the values in the xdata&lt;/SPAN&gt;
                            &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;foreach&lt;/SPAN&gt; &lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;TypedValue typeVal &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;in&lt;/SPAN&gt; rb&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;
                            &lt;SPAN style="color: #b060b0;"&gt;{&lt;/SPAN&gt;
                             
                                &lt;SPAN style="color: #e66170; font-weight: bold;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;typeVal&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;TypeCode &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #008c00;"&gt;1000&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;
                                &lt;SPAN style="color: #b060b0;"&gt;{&lt;/SPAN&gt;
                                    msg &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; msg &lt;SPAN style="color: #d2cd86;"&gt;+&lt;/SPAN&gt; layerName &lt;SPAN style="color: #d2cd86;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #00c4c4;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="color: #d2cd86;"&gt;+&lt;/SPAN&gt; typeVal&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;Value &lt;SPAN style="color: #d2cd86;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #00c4c4;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #02d045;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                                &lt;SPAN style="color: #b060b0;"&gt;}&lt;/SPAN&gt;
                            &lt;SPAN style="color: #b060b0;"&gt;}&lt;/SPAN&gt;
                        &lt;SPAN style="color: #b060b0;"&gt;}&lt;/SPAN&gt;
                        

                    &lt;SPAN style="color: #b060b0;"&gt;}&lt;/SPAN&gt;
                    t&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;Commit&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                &lt;SPAN style="color: #b060b0;"&gt;}&lt;/SPAN&gt;
                ed&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;WriteMessage&lt;SPAN style="color: #d2cd86;"&gt;(&lt;/SPAN&gt;msg&lt;SPAN style="color: #d2cd86;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                &lt;SPAN style="color: #9999a9;"&gt;// reset it back ASAP&lt;/SPAN&gt;
              HostApplicationServices&lt;SPAN style="color: #d2cd86;"&gt;.&lt;/SPAN&gt;WorkingDatabase &lt;SPAN style="color: #d2cd86;"&gt;=&lt;/SPAN&gt; oldDb&lt;SPAN style="color: #b060b0;"&gt;;&lt;/SPAN&gt;
                
            &lt;SPAN style="color: #b060b0;"&gt;}&lt;/SPAN&gt;

        &lt;SPAN style="color: #b060b0;"&gt;}&lt;/SPAN&gt;
&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 09:40:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-to-access-the-setup-for-the-layer-translator/m-p/7073964#M31701</guid>
      <dc:creator>moogalm</dc:creator>
      <dc:date>2017-05-10T09:40:24Z</dc:date>
    </item>
  </channel>
</rss>

