Raje Posted November 7, 2017 Share Posted November 7, 2017 Hii, i have layer names like "Earth Line'", "Steel Line", "Concrete Line" etc.. so i need select all mentioned layer named containing objects and delete them. any code for this task? Thankyou.. Quote Link to comment Share on other sites More sharing options...
LanloyLisp Posted November 7, 2017 Share Posted November 7, 2017 Command: LAYMRG Give it a try.. Quote Link to comment Share on other sites More sharing options...
Grrr Posted November 7, 2017 Share Posted November 7, 2017 Not tested: (defun C:test ( / acDoc SS ) (cond ( (not (ssget "X" '((8 . "Earth Line',Steel Line,Concrete Line")))) (prompt "\nNo Selection.") ) ( (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc) (vlax-map-collection (setq SS (vla-get-ActiveSelectionSet acDoc)) ''((x) (vl-catch-all-apply 'vla-Delete (list x)))) (vla-Delete SS) (vla-EndUndoMark acDoc) ) ) (princ) ) (vl-load-com)(princ) Quote Link to comment Share on other sites More sharing options...
Raje Posted November 7, 2017 Author Share Posted November 7, 2017 grrr thank you very much. it is working. can you provide selecting objects only? instead of delete. Thank you. Quote Link to comment Share on other sites More sharing options...
Grrr Posted November 7, 2017 Share Posted November 7, 2017 grrr thank you very much. it is working.can you provide selecting objects only? instead of delete. Thank you. Thanks for confirming, This should limit the selection to the active viewport (as my previous suggestion selects objects in all viewports - and that might be unwanted) : (defun C:test nil (sssetfirst nil (ssget "X" (list '(8 . "Earth Line',Steel Line,Concrete Line") (if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model")) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
LanloyLisp Posted November 7, 2017 Share Posted November 7, 2017 Give it a try.. My bad.. I thought you want to delete the layer itself.. Quote Link to comment Share on other sites More sharing options...
Raje Posted November 7, 2017 Author Share Posted November 7, 2017 Grrr thank you, it is also worked fine. Quote Link to comment Share on other sites More sharing options...
Raje Posted November 7, 2017 Author Share Posted November 7, 2017 My bad.. I thought you want to delete the layer itself.. LOL its ok and thank you.. 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.