Nguyen Thong Nhat Posted December 26, 2019 Share Posted December 26, 2019 Hi everyone, I have received a drawing with many layer (see attached image). I want to laytrans some layer (freeze) to a new layer but they have same prefix with other layer. So is there any lisp can find and add prefix all freeze layer in a drawing? then i can use laytrans easier. Thank you very much Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 26, 2019 Share Posted December 26, 2019 (edited) Try this and let me know how it works for you if possible? NOTE: You can change the word PREFIX- as noted below in the routine that suits your needs, besides that, the layer name 0 & DefPoints along with the External References layer names are excluded as well. (defun c:PrefLayer ( / lay lyn new lst) (while (setq lay (tblnext "LAYER" (null lay))) (or (wcmatch (setq lyn (cdr (assoc 2 lay))) "0,DefPoints,*|*") (and (= 1 (logand 1 (cdr (assoc 70 lay)))) (or (tblsearch "LAYER" (setq new (strcat "PREFIX-" lyn))) ;; change the prefix word that suits yours (entmod (subst (cons 2 new) (assoc 2 (setq lst (entget (tblobjname "LAYER" lyn)))) lst)) ) ) ) ) (princ) ) Edited December 26, 2019 by Tharwat Note added Quote Link to comment Share on other sites More sharing options...
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.