Great to see you around here again! Its been a long time![]()
Registered forum members do not see this ad.
Yes, it's mi. Thank you Lee Mac.ASMI, is that you?
Great to see you around here again! Its been a long time![]()
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
hi david, this is working like a charm, what could i do for the "by layer" entities is there another lisp that can swap the "by layer" with the actual color?. Also could this also be done adding linetype? generating layers based on color and linetype. layers could be named like "C8 hidden, C8 continuous, C11 dashdot, C11 hidden..."
thanks guys
For layer color and linetype - ( this could give a layer "C256-BYLAYER" )
For a bylayer values I would go to the layer table and find out what color and / or linetype is currently assigned to that layer.Code:(defun c:encl (/ ss en ed nl) (and (setq ss (ssget)) (while (setq en (ssname ss 0)) (setq ed (entget en)) (setq nl (if (assoc 62 ed) (strcat "C" (itoa (cdr (assoc 62 ed)))) "C256")) (setq nl (if (assoc 6 ed) (strcat nl "-" (cdr (assoc 6 ed))) (strcat nl "-BYLAYER"))) (entmod (subst (cons 8 nl) (assoc 8 ed) ed)) (ssdel en ss))) (prin1))
The default being "C7-CONTINUOUS"
There are probably a lot more elegant ways of doing this but who said I was elegant <g> -David
R12 (Dos) - A2K
With layer color and linetypes
Code:;;;CHANGED SELECTED ENTITIES TO CORRESPONDING COLOR ;;;AND LINETYPE LAYER (defun c:encld (/ ss en ed nl la ld nc nt ll) (and (setq ss (ssget)) (while (setq en (ssname ss 0)) (setq ed (entget en) la (cdr (assoc 8 ed)) ld (tblsearch "LAYER" la) nc (itoa (abs (cdr (assoc 62 (if (assoc 62 ed) ed ld))))) nt (cdr (assoc 6 (if (assoc 6 ed) ed ld))) nl (strcat "C" nc "-" nt)) (if (not (assoc nl ll)) ;;;SETUP LAYER DATA LIST (setq ll (cons (list nl "_C" nc) ll) ll (cons (list nl "_LT" nt) ll))) (entmod (subst (cons 8 nl) (assoc 8 ed) ed)) (ssdel en ss))) ;;;SETUP NEW LAYER COLORS AND LINETYPES (command "_.LAYER") (foreach v ll (command (nth 1 v) (nth 2 v) (nth 0 v))) (command "") (prin1))
Have Fun -David
R12 (Dos) - A2K
Bookmarks