Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Select Color Dialog Box from lisp

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Shinigami_black
2750 Views, 7 Replies

Select Color Dialog Box from lisp

Hi,

using autolisp or visual lisp I want to open "Select Color Dialog Box" http://exchange.autodesk.com/autocadarchitecture/enu/online-help/browse#WS1a9193826455f5ffa23ce210c4... and get RGB color code to my lisp.

If I enter "color" in command line, i get color dialog box, but if I use this command in (command "color") I get more promts and not color Dialog Box.

 

I want to make a lisp routine which would ask for first color, second color and range of colors. And will calculate color range from first color to second color.

 

Thanks.

7 REPLIES 7
Message 2 of 8
hmsilva
in reply to: Shinigami_black

Shinigami_black,

look in

 

"acad_truecolordlg" and "acad_colordlg" functions

 

hope that helps

Henrique

EESignature

Message 3 of 8
_Tharwat
in reply to: Shinigami_black

Try this function

 

(acad_truecolordlg 125)

Message 4 of 8

Thanks,

it is just what was necessary.

But I do not understand true color code returned from acad_truecolordlg. This one (420 . 7022356). It should be (“Red,Green,Blue”), but is some big number. How can I convert it to red,green,blue?

7022356 is color 107,39,20 in select color box.

Message 5 of 8
hmsilva
in reply to: Shinigami_black

Look in "color-util.lsp", from Autodesk, should be in the AutoCAD, Sample folder...

 

Henrique

EESignature

Message 6 of 8
Shinigami_black
in reply to: hmsilva

Thanks,

found it in my installation DVD. Half of Sample catalog is not installed.

Message 7 of 8
hmsilva
in reply to: Shinigami_black

You're welcome!

Henrique

EESignature

Message 8 of 8

Result:

 

(defun MakeColorRange (firstColor secondColor colorRange / rangeRed rangeGreen rangeBlue result)
    (setq rangeRed (fix (/ (- (car firstColor) (car secondColor)) colorRange)))
    (setq rangeGreen (fix (/ (- (cadr firstColor) (cadr secondColor)) colorRange)))
    (setq rangeBlue (fix (/ (- (caddr firstColor) (caddr secondColor)) colorRange)))
    (setq result (cons firstColor (setq result (list))))
    (repeat colorRange
        (setq firstColor (list (- (car firstColor) rangeRed) (- (cadr firstColor) rangeGreen) (- (caddr firstColor) rangeBlue)))
        (setq result (cons firstColor result))
    )
    (reverse result)
)

(defun C:ColorScheme ( / firstColor secondColor colorRange)
    (setq firstColor (TrueColor-split (cdr (assoc 420  (acad_truecolordlg '(420 . 2686760) nil)))))
    (setq secondColor (TrueColor-split (cdr (assoc 420  (acad_truecolordlg '(420 . 2686760) nil)))))
    (setq colorRange (- (getint "\n Enter color range number: ") 1))
    (princ (MakeColorRange firstColor secondColor colorRange))
    (princ)
)

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost