<?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: Read xref layer color overrides in model space in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/read-xref-layer-color-overrides-in-model-space/m-p/13978081#M86425</link>
    <description>&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/net-forum/layertablerecord-linetypeobjectid-of-xref-dependent-layers/m-p/5428510#M42605" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/net-forum/layertablerecord-linetypeobjectid-of-xref-dependent-layers/m-p/5428510#M42605&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take a look at the link above in message 8 of 15 from &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/765444"&gt;@Balaji_Ram&lt;/a&gt;. I tested the code and it worked correctly for me. In the code snippet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Reset the layer color
layerTableRec.Color = ltr2.Color;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jan 2026 16:26:16 GMT</pubDate>
    <dc:creator>Gepaha</dc:creator>
    <dc:date>2026-01-15T16:26:16Z</dc:date>
    <item>
      <title>Read xref layer color overrides in model space</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-xref-layer-color-overrides-in-model-space/m-p/13974063#M86415</link>
      <description>&lt;P&gt;I'm trying to get the model space layer colors for external references.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a model.dwg with an xref.dwg linked, where xref.dwg has a layer called "layer123" which is set to color 9.&lt;/P&gt;&lt;P&gt;If I open the model.dwg in AutoCAD I can see that xref|layer123 has a color override set to 255, 128, 128, but when I look at the layer from the API LayerTableRecord.Color returns the original xref color (ByAci / ACI 9 / RGB 192,192,192).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've checked these system variables if that matters and the values are:&lt;/P&gt;&lt;P&gt;VISRETAIN = 1&lt;BR /&gt;VISRETAINMODE = 0&lt;BR /&gt;XREFOVERRIDE = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a shortened version of my code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I'm reading model.dwg as a side db&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using (var sideDb = new Database(false, true))
{
    sideDb.ReadDwgFile(sideDbPath, FileOpenMode.OpenForReadAndAllShare, false, null);
    sideDb.ResolveXrefs(true, false);
    message.FileContents.Layers = LayerHandler.GetLayers(sideDb);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal static void GetLayers(Database db)
{
    using (Transaction transaction = db.TransactionManager.StartTransaction())
    {
        var layerTable = transaction.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;

        foreach (var layObj in layerTable)
        {
            var lay = layObj.GetObject(OpenMode.ForRead) as LayerTableRecord;
            var color = lay.Color;
            // do stuff...
        }

        transaction.Dispose();
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 21:38:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-xref-layer-color-overrides-in-model-space/m-p/13974063#M86415</guid>
      <dc:creator>ottosson_mathias</dc:creator>
      <dc:date>2026-01-12T21:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Read xref layer color overrides in model space</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-xref-layer-color-overrides-in-model-space/m-p/13977178#M86422</link>
      <description>&lt;P&gt;You might try from the host drawing, AI says you can get the LayerTableRecord override from LayerTable by using “xrefName|layer123”. If not, the overrides are probably stored in an extension dictionary in the LTR in the host drawing&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2026 01:56:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-xref-layer-color-overrides-in-model-space/m-p/13977178#M86422</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2026-01-15T01:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Read xref layer color overrides in model space</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-xref-layer-color-overrides-in-model-space/m-p/13978081#M86425</link>
      <description>&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/net-forum/layertablerecord-linetypeobjectid-of-xref-dependent-layers/m-p/5428510#M42605" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/net-forum/layertablerecord-linetypeobjectid-of-xref-dependent-layers/m-p/5428510#M42605&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take a look at the link above in message 8 of 15 from &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/765444"&gt;@Balaji_Ram&lt;/a&gt;. I tested the code and it worked correctly for me. In the code snippet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Reset the layer color
layerTableRec.Color = ltr2.Color;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2026 16:26:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-xref-layer-color-overrides-in-model-space/m-p/13978081#M86425</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2026-01-15T16:26:16Z</dc:date>
    </item>
  </channel>
</rss>

