Nikon Posted May 18 Posted May 18 (edited) Is it possible to get lines with all layer properties using lisp, and next to each line, specify the name of the layer. Maybe there is already such a lisp? Edited May 20 by Nikon Quote
BIGAL Posted May 18 Posted May 18 You can be lucky owe me a cup of coffee. ; Oct 2022 ; By AlanH makes a legend of used layers and blocks. (defun RemoveDupes (InLst / OutLst CarElm) (while InLst (setq InLst (vl-remove (setq CarElm (car InLst)) (cdr InLst)) OutLst (cons CarElm OutLst) ) ) ) (defun makelegend ( / ss lst lstrem obj pt pt2 ltname x val bname) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setvar 'textstyle "Standard") (setq oldlay (getvar 'clayer)) (setvar 'clayer "0") (setvar 'ctab "Model") (setq ss (ssget "X" (list (cons 410 "Model")))) (setq lst '()) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq lst (cons (list (vla-get-layer obj) (vlax-get obj 'Linetype)) lst)) ) (setq lst (RemoveDupes lst)) (setq lst (vl-sort lst '(lambda (x y) (< (car x) (car y))))) (setq pt (getpoint "\nPick point for line legend ")) (setq pt2 (mapcar '+ pt (list 125.0 0.0 0.0))) (foreach ltname lst (command "line" pt (mapcar '+ pt (list 20.0 0.0 0.0)) "") (command "chprop" (entlast) "" "LA" (car ltname) "LT" (cadr ltname) "S" 0.25 "") (command "text" (mapcar '+ pt (list 25.0 0.0 0.0)) 2.5 0.0 (car ltname)) (setq pt (mapcar '+ pt (list 0.0 10.0 0.0))) ) (setq lst '()) (setq attreq 0) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (if (= (vla-get-objectname obj) "AcDbBlockReference") (setq lst (cons (vla-get-name obj) lst)) ) ) (setq lst (RemoveDupes lst)) (setq lst (vl-sort lst '(lambda (x y) (< x y)))) (foreach val lst (if (wcmatch val "*U#*" ) (setq lst (vl-remove val lst)) ) ) (foreach bname lst (progn (command "text" (mapcar '+ pt2 (list 25.0 0.0 0.0)) 2.5 0.0 bname) (command "-insert" bname pt2 1 1 0) (setq pt2 (mapcar '+ pt2 (list 0.0 10.0 0.0))) (setq obj (vlax-ename->vla-object (entlast))) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pointmin (vlax-safearray->list minpoint)) (setq pointmax (vlax-safearray->list maxpoint)) (setq ht (- (cadr pointmax)(cadr pointmin))) (setq xscale (/ 5.0 ht)) (vla-put-xscalefactor obj xscale) (vla-put-yScaleFactor obj xscale) ) ) (setvar 'osmode oldsnap) (setvar 'clayer oldlay) (princ) ) (makelegend) 1 Quote
Nikon Posted May 19 Author Posted May 19 (edited) On 19.05.2024 at 01:40, BIGAL said: You can be lucky owe me a cup of coffee. @BIGAL Thanks a lot! It works great! Edited May 20 by Nikon Quote
SLW210 Posted May 20 Posted May 20 I created a new thread, stop adding on to other threads with a different from the original question. Get lines with all layer properties using lisp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.