Gio_S
Guest
hello to all, in lisp what is the easiest way to extract from a layer (knowing its name) the color that was eventually assigned to it to color its color entities "bylayer"? (lisp, no vla)
Thank you!
Thank you!
(defun fnlayers(/l x)
(vlax-for x (vla-get-layers (vla-get-activedocument(vlax-get-acad-object)))
(setq l (append l (list (vla-get-name x)))))
)
l l
)
(defun fnlayers(/ loop nome colore lista)
(setq loop (tblnext "layer" t))
(while loop
(setq nome (cdr (nth 1 loop)))
(setq colore (cdr (nth 3 loop)))
(setq lista (append lista (list (list nome colore))))
(setq loop (tblnext "layer"))
)
lista
)
e' possibile con:...point directly to the layer, after extracting the name of the layer of an object. . .
(if (= "3dface" (cdr(assoc 0 alist)))
(progn
(if (= 256 (cdr (assoc 62 alist)))
(setq color (rtos (cdr (assoc 62 (tblsearch "layer" (cdr (assoc 8 alist)) )))))
(setq color (rtos (cdr (assoc 62 alist))))
) .......................
Just a curiosity. in autocad, when you make the selection autolisp, if the color is not forced, the code 62 is not active, it appears only otherwise, then (62 . 256) must necessarily be "fruit" of another cad. in fact among the software used by gio_s there is intellicad, compatible autolisp, but not for vla-vlax functions. that the experts lisp correct me if I said a nonsense.perfect, with my old autolisp:
Code:(if (= "3dface" (cdr(assoc 0 alist))) (progn (if (= 256 (cdr (assoc 62 alist))) (setq color (rtos (cdr (assoc 62 (tblsearch "layer" (cdr (assoc 8 alist)) ))))) (setq color (rtos (cdr (assoc 62 alist)))) ) .......................
Normal facet -0.23379819 0.20359900 -0.95072912
outside loop
vertex 3.70767496 -2.34397192 -4.4987455
vertex 3.68773415 -1.27682691 -4.26531230
vertex 4.25378586 0.00000000 -4.13107972
endloop
endfacet cad color 700000000