TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DanB on January 26, 2006, 03:26:32 PM

Title: Choose a color
Post by: DanB on January 26, 2006, 03:26:32 PM
As part of another lisp I am working on I wanted to utilize the command "color" which brings up the select color dialog. Any reason this does not "pop up" when run in the following code?

Code: [Select]
(defun c:coloring (/ oldecho oldcolor newcolor)
 (setq oldecho (getvar "cmdecho"))
 (setvar "cmdecho" 1)
 (setq oldcolor (getvar "cecolor"))
 (command ".color" pause)
 (setq newcolor (getvar "cecolor"))
 (prompt (strcat "\nThe OLD color was <" oldcolor "> and the NEW color is <" newcolor ">"))
 (setvar "cmdecho" oldecho)
 (princ)
)

Thanks,
Dan
Title: Re: Choose a color
Post by: T.Willey on January 26, 2006, 03:32:48 PM
Try this.
Code: [Select]
(setq xclr (acad_colordlg 252))
The 252 at the end is the default value I wanted, you can change it if you like.
Title: Re: Choose a color
Post by: DanB on January 26, 2006, 04:24:25 PM
Thanks, I think that will work, going to need to try it out though...
Title: Re: Choose a color
Post by: CADmium on January 27, 2006, 02:40:04 AM
look here (http://hyperpics.blogs.com/beyond_the_ui/autolispvisual_lisp/) .. scroll down to  "Adding the ability to select True Colors to your LISP programs"
Title: Re: Choose a color
Post by: CAB on January 27, 2006, 09:39:52 AM
Welcome to the Swamp Lee.

Nice web site, thanks. :-)