Can i use HSL color codes?

Can i use HSL color codes?

venturini.anthony
Advocate Advocate
329 Views
2 Replies
Message 1 of 3

Can i use HSL color codes?

venturini.anthony
Advocate
Advocate

this lisp currently changes one layers color to 8. is there a way to make it so instead of reading color 8 from the index colors, it can use a true color and I can just input the HSL numbers instead

 

(vl-load-com)

(defun c:colorize (/ *error* c_doc c_lyrs)

; localised error function
(defun *error* ( msg )
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred.")))
(princ)
);_end_*error*_defun

;initial setups here
(setq c_doc (vla-get-ActiveDocument (vlax-get-acad-object))
c_lyrs (vla-get-layers c_doc)
);end_setq

;start of altering drawing
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(vla-startundomark c_doc)

;color changing
(command "_.layer" "_color" 8 "BEL-CABLE" "")

(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(princ)
);end_defun

0 Likes
330 Views
2 Replies
Replies (2)
Message 2 of 3

hak_vz
Advisor
Advisor

@Lee_Mac has color conversion function posted at his site.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 3

Sea-Haven
Mentor
Mentor

I did -layer color and it accepted 128,128,128 as color, using Bricscad.

0 Likes