<?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: AutoCAD Color Selector in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492529#M38837</link>
    <description>http://discussion.autodesk.com/thread.jspa?messageID=4164145</description>
    <pubDate>Tue, 22 Nov 2005 00:17:57 GMT</pubDate>
    <dc:creator>RonnieWilkins</dc:creator>
    <dc:date>2005-11-22T00:17:57Z</dc:date>
    <item>
      <title>AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492528#M38836</link>
      <description>What library can I find the AutoCAD standard color selector in? Is it &lt;BR /&gt;
documented anywhere? What methods and properties does it have?&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Kenneth Hutson&lt;BR /&gt;
San Antonio, TX</description>
      <pubDate>Mon, 21 Nov 2005 23:59:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492528#M38836</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-21T23:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492529#M38837</link>
      <description>http://discussion.autodesk.com/thread.jspa?messageID=4164145</description>
      <pubDate>Tue, 22 Nov 2005 00:17:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492529#M38837</guid>
      <dc:creator>RonnieWilkins</dc:creator>
      <dc:date>2005-11-22T00:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492530#M38838</link>
      <description>Kenneth ,&lt;BR /&gt;
&lt;BR /&gt;
There is no Acad color library, but you can use the Acad Color&lt;BR /&gt;
selector used in the layer manager.&lt;BR /&gt;
I got this Lisp routine from someone on this group.  This is any easy way to show the color dialog box and get the value of the color selected from lisp to VBA using USERI5 variable.&lt;BR /&gt;
&lt;BR /&gt;
Search this group for USERI  if you do not know about these acad internal variables.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Function ColorDialog() As Integer&lt;BR /&gt;
&lt;BR /&gt;
Dim intVariable As Integer&lt;BR /&gt;
&lt;BR /&gt;
If Connect Then&lt;BR /&gt;
objAcad.Application.WindowState = acMin&lt;BR /&gt;
'calls the acad color dialog and returns&lt;BR /&gt;
'the index of the color selected or -1 if cancelled&lt;BR /&gt;
'store current sysvar value&lt;BR /&gt;
intVariable = ThisDrawing1.GetVariable("USERI5")&lt;BR /&gt;
'call color dialog&lt;BR /&gt;
ThisDrawing1.SendCommand ("(setq clr (acad_colordlg 1))" &amp;amp; vbCr)&lt;BR /&gt;
ThisDrawing1.SendCommand ("(if (= clr nil)" &amp;amp; _&lt;BR /&gt;
"(setvar ""USERI5"" -1)" &amp;amp; _&lt;BR /&gt;
"(setvar ""USERI5"" clr))" &amp;amp; vbCr)&lt;BR /&gt;
ColorDialog = ThisDrawing1.GetVariable("USERI5")&lt;BR /&gt;
'reset sysvar&lt;BR /&gt;
ThisDrawing1.SetVariable "USERI5", intVariable&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Fred C.</description>
      <pubDate>Tue, 22 Nov 2005 18:50:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492530#M38838</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-11-22T18:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492531#M38839</link>
      <description>Fred,&lt;BR /&gt;
You need to be careful with that function. Since it utilizes SendCommnad,&lt;BR /&gt;
its likely you will not get the correct value. Use the vlisp interface to&lt;BR /&gt;
set the sysvar. Better yet use the vlisp interface to return the value&lt;BR /&gt;
directly to vba.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
----&lt;BR /&gt;
Ed&lt;BR /&gt;
----&lt;BR /&gt;
&lt;FXCASTIL&gt; wrote in message news:5020375@discussion.autodesk.com...&lt;BR /&gt;
Kenneth ,&lt;BR /&gt;
&lt;BR /&gt;
There is no Acad color library, but you can use the Acad Color&lt;BR /&gt;
selector used in the layer manager.&lt;BR /&gt;
I got this Lisp routine from someone on this group.  This is any easy way to&lt;BR /&gt;
show the color dialog box and get the value of the color selected from lisp&lt;BR /&gt;
to VBA using USERI5 variable.&lt;BR /&gt;
&lt;BR /&gt;
Search this group for USERI  if you do not know about these acad internal&lt;BR /&gt;
variables.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Function ColorDialog() As Integer&lt;BR /&gt;
&lt;BR /&gt;
Dim intVariable As Integer&lt;BR /&gt;
&lt;BR /&gt;
If Connect Then&lt;BR /&gt;
objAcad.Application.WindowState = acMin&lt;BR /&gt;
'calls the acad color dialog and returns&lt;BR /&gt;
'the index of the color selected or -1 if cancelled&lt;BR /&gt;
'store current sysvar value&lt;BR /&gt;
intVariable = ThisDrawing1.GetVariable("USERI5")&lt;BR /&gt;
'call color dialog&lt;BR /&gt;
ThisDrawing1.SendCommand ("(setq clr (acad_colordlg 1))" &amp;amp; vbCr)&lt;BR /&gt;
ThisDrawing1.SendCommand ("(if (= clr nil)" &amp;amp; _&lt;BR /&gt;
"(setvar ""USERI5"" -1)" &amp;amp; _&lt;BR /&gt;
"(setvar ""USERI5"" clr))" &amp;amp; vbCr)&lt;BR /&gt;
ColorDialog = ThisDrawing1.GetVariable("USERI5")&lt;BR /&gt;
'reset sysvar&lt;BR /&gt;
ThisDrawing1.SetVariable "USERI5", intVariable&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Fred C.&lt;/FXCASTIL&gt;</description>
      <pubDate>Tue, 22 Nov 2005 20:13:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492531#M38839</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-22T20:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492532#M38840</link>
      <description>Ed,&lt;BR /&gt;
&lt;BR /&gt;
You say "Since it utilizes SendCommnad, its likely you will not get the correct value"   Several users have been using this function and have been getting the correct color value. Can you elaborate and maybe show example of using Vlisp interface.  I have searched the group for "Vlisp Interface "&lt;BR /&gt;
and I am not sure how to do this .&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Fred Castillo</description>
      <pubDate>Tue, 22 Nov 2005 23:45:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492532#M38840</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-11-22T23:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492533#M38841</link>
      <description>Well, the SendCommand method is asyncronous and may (likely) run after your&lt;BR /&gt;
vba code completes. Here is a possible sequence of events.&lt;BR /&gt;
1. Call main function&lt;BR /&gt;
2. dwg variable = 0&lt;BR /&gt;
3. issue lisp via SendCommand&lt;BR /&gt;
4. function returns 0 from dwg variable&lt;BR /&gt;
5. SendCommand finishes&lt;BR /&gt;
6. dwg variable = some #&lt;BR /&gt;
&lt;BR /&gt;
The big problem here is that the function has no way to validate the data&lt;BR /&gt;
stored in the dwg variable.&lt;BR /&gt;
&lt;BR /&gt;
The visual lisp interface can be accessed using:&lt;BR /&gt;
Set vl = ThisDrawing.Application.GetInterfaceObject("VL.Application.1")&lt;BR /&gt;
&lt;BR /&gt;
You can download vlax.cls from www.acadx.com which makes using vl easy.&lt;BR /&gt;
&lt;BR /&gt;
I wrote this function for use with vlax.cls.&lt;BR /&gt;
&lt;BR /&gt;
Public Function AcadColorDialog() As Integer&lt;BR /&gt;
    'calls the acad color dialog and returns&lt;BR /&gt;
    'the index of the color selected or -1 if cancelled&lt;BR /&gt;
    Dim i As Integer&lt;BR /&gt;
    Dim vl As New VLAX&lt;BR /&gt;
&lt;BR /&gt;
    'call color dialog&lt;BR /&gt;
    vl.EvalLispExpression ("(setq clr (acad_colordlg 1))")&lt;BR /&gt;
    'if dialog was canceled, clr will be nil, set to -1 instead&lt;BR /&gt;
    i = vl.EvalLispExpression("(if (= clr nil)(setq clr -1)(setq clr clr))")&lt;BR /&gt;
    AcadColorDialog = i&lt;BR /&gt;
    Set vl = Nothing&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
You can use a similar method with the (getfiled) function if you need to use&lt;BR /&gt;
acad's dialog rather than a vba dialog.&lt;BR /&gt;
&lt;BR /&gt;
Another way I forgot about is mentioned here:&lt;BR /&gt;
http://discussion.autodesk.com/thread.jspa?messageID=4147470&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
----&lt;BR /&gt;
Ed&lt;BR /&gt;
----</description>
      <pubDate>Wed, 23 Nov 2005 00:45:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492533#M38841</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-23T00:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492534#M38842</link>
      <description>Ed, &lt;BR /&gt;
&lt;BR /&gt;
I am attaching my attempt at using the vlax.cls , I added reference to vlisp.tlb . But I do not see anyting in object browser with "Attribute" . I see this at top of vlax.cls ?? &lt;BR /&gt;
I use VBA not lisp or Vlisp so I am stuck in the mud. Searched the post looked at curve.cls sample at acadx.com same stuff at header, get error at stuff below.&lt;BR /&gt;
&lt;BR /&gt;
BEGIN&lt;BR /&gt;
  MultiUse = -1  'True&lt;BR /&gt;
End&lt;BR /&gt;
&lt;BR /&gt;
Attribute VB_Name = "VLAX"&lt;BR /&gt;
Attribute VB_GlobalNameSpace = False&lt;BR /&gt;
Attribute VB_Creatable = False&lt;BR /&gt;
Attribute VB_PredeclaredId = False&lt;BR /&gt;
Attribute VB_Exposed = False&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Fred C</description>
      <pubDate>Wed, 23 Nov 2005 02:49:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492534#M38842</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-11-23T02:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492535#M38843</link>
      <description>The answer is to delete the red stuff (all the items that show up in red are not needed for vba)</description>
      <pubDate>Wed, 23 Nov 2005 06:12:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492535#M38843</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-23T06:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492536#M38844</link>
      <description>Not sure why you are recieving an error. None of that should even show up in&lt;BR /&gt;
the ide. Did you just copy the code into a code module or did you import the&lt;BR /&gt;
class from file?&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
----&lt;BR /&gt;
Ed&lt;BR /&gt;
----</description>
      <pubDate>Wed, 23 Nov 2005 15:04:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492536#M38844</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-23T15:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492537#M38845</link>
      <description>Ed, &lt;BR /&gt;
&lt;BR /&gt;
I had copied and pasted this into a class module , I now imported this as file . Now it works , this was too easy !&lt;BR /&gt;
&lt;BR /&gt;
Thanks Again&lt;BR /&gt;
&lt;BR /&gt;
Fred C.</description>
      <pubDate>Wed, 23 Nov 2005 22:08:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492537#M38845</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-11-23T22:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD Color Selector</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492538#M38846</link>
      <description>Great.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
----&lt;BR /&gt;
Ed&lt;BR /&gt;
----</description>
      <pubDate>Thu, 24 Nov 2005 00:12:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-color-selector/m-p/1492538#M38846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-24T00:12:06Z</dc:date>
    </item>
  </channel>
</rss>

