anindya Posted October 3, 2014 Share Posted October 3, 2014 Sir i have to create layers by selection of objectes.i have attached 2 sample drawing for observation.i can do it in going layer command and create different layers with diff name and colours and then through properties include them on that but it is time taking....can it possible by lisp easily??????? 49000 HELP.dwg 50000 HELP.dwg Quote Link to comment Share on other sites More sharing options...
iconeo Posted October 4, 2014 Share Posted October 4, 2014 Sir i have to create layers by selection of objectes.i have attached 2 sample drawing for observation.i can do it in going layer command and create different layers with diff name and colours and then through properties include them on that but it is time taking....can it possible by lisp easily??????? Why not just make them all once using macro recorder? Then you can just play the macro whenever you need to. No lisp required. Quote Link to comment Share on other sites More sharing options...
anindya Posted October 4, 2014 Author Share Posted October 4, 2014 how to do that one????????pls tell me..if it is possible by any macro pls provide me. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 4, 2014 Share Posted October 4, 2014 You can also do a simple script just save/make a new one in notepad with file extension .SCR and SCRIPT to load -layer n lay1 C lay1 1 LT lay1 dashed n lay2 c lay2 4 LT center n lay3 c 5 lay3 LT dashed2 Quote Link to comment Share on other sites More sharing options...
hmsilva Posted October 5, 2014 Share Posted October 5, 2014 Sir i have to create layers by selection of objectes.i have attached 2 sample drawing for observation.i can do it in going layer command and create different layers with diff name and colours and then through properties include them on that but it is time taking....can it possible by lisp easily??????? As a starting point (defun c:demo (/ col ent flag flag1 i lay ss) (setq flag1 T) (while (and flag1 (setq ss (ssget ":L")) ) (setq flag T) (while flag (setq lay (getstring t "\nEnter New Layer Name <exit>: ")) (cond ((tblsearch "layer" lay) (prompt "\nLayer Already Exists!!!") ) ((= lay "") (setq flag nil) (setq flag1 nil) ) ((not (snvalid lay)) (prompt "\nInvalid Layer Name!!!") ) ((and (not (tblsearch "layer" lay)) (snvalid lay) (setq col (acad_colordlg 7)) ) (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 lay) '(70 . 0) (cons 62 col) '(6 . "Continuous") ) ) (repeat (setq i (sslength ss)) (setq ent (entget (ssname ss (setq i (1- i))))) (entmod (subst (cons 8 lay) (assoc 8 ent) ent)) ) (setq flag nil) ) (T (setq flag nil) (setq flag1 nil) ) );; cond );; while );; while (princ) ) Hope that helps Henrique Quote Link to comment Share on other sites More sharing options...
ReMark Posted October 5, 2014 Share Posted October 5, 2014 The proper way to address this problem is to create a master template file with the layers already included. Thus, whenever a new drawing is created using the template the layers are immediately available for use. Work smarter...not harder. Lisp isn't necessarily the answer to every problem. Quote Link to comment Share on other sites More sharing options...
anindya Posted October 5, 2014 Author Share Posted October 5, 2014 hmsilva sir that is excellent.No doubt you are great.it works great.....thanks a lot. Quote Link to comment Share on other sites More sharing options...
hmsilva Posted October 5, 2014 Share Posted October 5, 2014 You're welcome, anindya Glad I could help Henrique 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.