PDA

View Full Version : Color to new layer Lisp


BCrouse
2008-02-05, 04:54 PM
I am trying to find a lisp routine that you can input a number of a colored hatch. This will allow you to give it a new layer to associate with color. Does anyone know where I could find one?

Adesu
2008-02-06, 02:23 AM
Hi BCrouse,
I'm not sure, this code would help you, but test it.

(defun c:test (/ col1 col2 el1 el2 hcol p1 p2 p3 p4 p5 sse)
(setq clay (getvar "clayer"))
(setq ccol (getvar "cecolor"))
(setq col1 "5")
(setvar "cecolor" col1)
(setq p1 '(0 0 0))
(setq p2 '(10 0 0))
(setq p3 '(10 5 0))
(setq p4 '(0 5 0))
(command "_pline" p1 p2 p3 p4 "c" "")
(command "zoom" "e")
(setq el1 (entlast))
(setq p5 '(5 5 0))
(setq col2 "1")
(setvar "cecolor" col2)
(command "_bhatch" "p" "ansi31" 0.25 0 "s" el1 "" "")
(setq el2 (entlast))
(setq sse (entget el2))
(setq hcol (cdr (assoc 62 sse)))
(command "_layer" "m" "BCrouse" "c" hcol "" "")
(setvar "clayer" clay)
(setvar "cecolor" ccol)
(princ)
) ; defun


I am trying to find a lisp routine that you can input a number of a colored hatch. This will allow you to give it a new layer to associate with color. Does anyone know where I could find one?