<?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 get the properties object color in c# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6725749#M33680</link>
    <description>&lt;P&gt;this might be of help:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Database db1 = Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.Colors.Color colorOfDB = db.Cecolor;&lt;/PRE&gt;&lt;P&gt;It's not .net but it should help with your solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/autocad/2012/05/color-translation-between-rgb-and-autocad-aci-using-objectarx.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/05/color-translation-between-rgb-and-autocad-aci-using-objectarx.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or you can use the following properties to get the bytes to convert to any color structure you wish :&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;&lt;PRE&gt;colorOfDB.Blue&amp;nbsp;
colorOfDB.Red
colorOfDB.Green&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Dec 2016 14:22:14 GMT</pubDate>
    <dc:creator>BKSpurgeon</dc:creator>
    <dc:date>2016-12-03T14:22:14Z</dc:date>
    <item>
      <title>how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6725469#M33679</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.png" style="width: 495px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/298652i73DC591AB6F8A758/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi all, I am trying to retrieve the object color in RGB or TrueColor Mode. I have try to get the data with the following code, but the cecolor return in string but not TrueColor. Anyone have idea how to do this? Thanks&lt;/P&gt;&lt;PRE&gt;acAppComObj = (AutoCAD.AcadApplication)Marshal.GetActiveObject("AutoCAD.Application");&lt;BR /&gt;string cecolor = acDocComObj.GetVariable("CECOLOR");&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Dec 2016 03:43:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6725469#M33679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-03T03:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6725749#M33680</link>
      <description>&lt;P&gt;this might be of help:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Database db1 = Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.Colors.Color colorOfDB = db.Cecolor;&lt;/PRE&gt;&lt;P&gt;It's not .net but it should help with your solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/autocad/2012/05/color-translation-between-rgb-and-autocad-aci-using-objectarx.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/05/color-translation-between-rgb-and-autocad-aci-using-objectarx.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or you can use the following properties to get the bytes to convert to any color structure you wish :&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;&lt;PRE&gt;colorOfDB.Blue&amp;nbsp;
colorOfDB.Red
colorOfDB.Green&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2016 14:22:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6725749#M33680</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2016-12-03T14:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726383#M33681</link>
      <description>&lt;P&gt;Thanks for the reply. However I am not sure whether this code is work, because I am currently develop an interop code&amp;nbsp;but this code seem like work at in-process code.&amp;nbsp;&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://forums.autodesk.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2016 09:16:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726383#M33681</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-04T09:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726384#M33682</link>
      <description>&lt;P&gt;Thanks for the reply. However I am not sure whether this code is work, because I am currently develop an interop code&amp;nbsp;but this code seem like work at in-process code.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2016 09:19:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726384#M33682</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-04T09:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726477#M33683</link>
      <description>&lt;P&gt;For RGB color CECOLOR value is string like a "&lt;STRONG&gt;RGB&lt;/STRONG&gt;:RRR,GGG,BBB". So you can get all RGB components from this string.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2016 12:43:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726477#M33683</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-12-04T12:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726493#M33684</link>
      <description>&lt;P&gt;Hi, Thanks&amp;nbsp;Alexander. However, it maybe not always return the exact value like the format you wrote, if user select the color from color books, it will have format like "DIC COLOR GUIDE(R) PART II$DIC 2003".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;p/s: Is there anywhere to convert these string to color index?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2016 13:04:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726493#M33684</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-04T13:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726496#M33685</link>
      <description>&lt;P&gt;Maybe this link help you: &lt;A href="https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-D24C6BB5-5F87-42E7-907F-F27226B330E3-htm.html" target="_blank"&gt;https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-D24C6BB5-5F87-42E7-907F-F27226B330E3-htm.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2016 13:06:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726496#M33685</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-12-04T13:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726543#M33686</link>
      <description>&lt;P&gt;Thanks again, however from what I read it just show the method of set the color to the object with the r g b value but I found no way to get the color value of the properties that preset in the AutoCad.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2016 13:52:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726543#M33686</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-04T13:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726682#M33687</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a quick and dirty (not tested &amp;nbsp;and no error handling)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        private AcadAcCmColor GetAcCmColor(string colorName)
        {
            AcadAcCmColor color = new AcadAcCmColor();
            int index = 0;
            if (colorName.ToUpper() == "BYBLOCK")
            {
                color.ColorIndex = AcColor.acByBlock;
            }
            else if (colorName.ToUpper() == "BYLAYER")
            {
                color.ColorIndex = AcColor.acByLayer;
            }
            else if (int.TryParse(colorName, out index))
            {
                color.ColorIndex = (AcColor)index;
            }
            else if (colorName.ToUpper().StartsWith("RGB:"))
            {
                string[] rgb = colorName.Substring(4).Split(',');
                color.SetRGB(int.Parse(rgb[0]), int.Parse(rgb[1]), int.Parse(rgb[2]));
            }
            else
            {
                string[] bookColor = colorName.Split('$');
                color.SetColorBookColor(bookColor[0], bookColor[1]);
            }
            return color;
        }&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Dec 2016 17:58:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6726682#M33687</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-12-04T17:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the properties object color in c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6727137#M33688</link>
      <description>&lt;P&gt;Hi Sir Gile, your solution is awesome! Thanks for your help! It really solve my problem!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 04:07:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-the-properties-object-color-in-c/m-p/6727137#M33688</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-05T04:07:41Z</dc:date>
    </item>
  </channel>
</rss>

