omL20Studio Posted August 29, 2014 Share Posted August 29, 2014 Hi All! I'm new to the world of AutoLISP and would appreciate some help. I'd like a lisp routine that deletes specific layers (and any entities within them) from all of the drawings in a particular directory (which I can select at the beginning of the routine). The list of layers can be specific to the routine since all of the drawings have the same ones. I have over 1000 drawings that I need to do this to and I really don't want to have to do them all individually. Thanks in advance for the help! Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 29, 2014 Share Posted August 29, 2014 Sounds like a script that could batch process a folder full of drawings would be the way to go. Quote Link to comment Share on other sites More sharing options...
omL20Studio Posted August 29, 2014 Author Share Posted August 29, 2014 (edited) ReMark, Heres what i have so far: (defun c:ELAYER (/ aDoc name) (setvar 'Clayer "0") (repeat 4 (vla-purgeall (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))))) (vlax-for itm (vla-get-layers aDoc) (if (and (not (wcmatch (setq name (vla-get-name itm)) "*|*")) (not (eq name "0")) (not (member name '("STREETCL_CENTERLINE" "SPOT_X_WATER_TEST" "SPOT_X_GROUND_TEXT" "SPOT_X_GROUND" "SPOT_X_BRIDGE_TEXT" "SPOT_X_BRIDGE" "RAILROAD_CENTERLINE" "CONTOUR_SIXHUNDEREDEIGHTYONE" "CONTOUR_LABEL" "CONTOUR_INTER_DEP" "CONTOUR_INTER" "CONTOUR_INDEX_DEP" "CONTOUR_INDEX" "CONTOUR_FOURNINETYTWO" "SPOT_X_WATER")))) (progn (vla-put-lock itm :vlax-false) (vl-cmdf "_.-laydel" "_N" name "" "_Y")) ) ) (repeat 4 (vla-purgeall aDoc)) (princ) ) I get an error on the vlax-get-acad-object command and it doesn't have batch processing yet. any thoughts? Edited September 2, 2014 by SLW210 Code Tags Quote Link to comment Share on other sites More sharing options...
omL20Studio Posted August 29, 2014 Author Share Posted August 29, 2014 OK, I fixed the error and now the routine works great. how can I make it a batch process on multiple .dxf drawings in the same folder? (defun c:ELAYER (/ aDoc name) (setvar 'Clayer "0") (repeat 4 (vla-purgeall (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))))) (vlax-for itm (vla-get-layers aDoc) (if (and (not (wcmatch (setq name (vla-get-name itm)) "*|*")) (not (eq name "0")) (not (member name '("STREETCL_CENTERLINE" "SPOT_X_WATER_TEST" "SPOT_X_GROUND_TEXT" "SPOT_X_GROUND" "SPOT_X_BRIDGE_TEXT" "SPOT_X_BRIDGE" "RAILROAD_CENTERLINE" "CONTOUR_SIXHUNDEREDEIGHTYONE" "CONTOUR_LABEL" "CONTOUR_INTER_DEP" "CONTOUR_INTER" "CONTOUR_INDEX_DEP" "CONTOUR_INDEX" "CONTOUR_FOURNINETYTWO" "SPOT_X_WATER")))) (progn (vla-put-lock itm :vlax-false) (vl-cmdf "_.-laydel" "_N" name "" "_Y")) ) ) (repeat 4 (vla-purgeall aDoc)) (princ) ) Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 29, 2014 Share Posted August 29, 2014 I think you would have to write a script that "calls" the lisp routine. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 30, 2014 Share Posted August 30, 2014 You could evaluate your program through my old Script Writer application, using the following Script Line: _.open *file* (load "[color=red]YourLISP.lsp[/color]" nil) (if [color=red]c:YourCommand[/color] ([color=red]c:YourCommand[/color])) _.qsave _.close Change the items marked in red as appropriate. Quote Link to comment Share on other sites More sharing options...
haqrao Posted February 22, 2017 Share Posted February 22, 2017 would you please proper scripts name and command as well. its more easy if you can put in youtube, prints screen example like that Regards Imran Quote Link to comment Share on other sites More sharing options...
haqrao Posted February 22, 2017 Share Posted February 22, 2017 how can i use the scripts please make the print screen as a example. Quote Link to comment Share on other sites More sharing options...
haqrao Posted February 26, 2017 Share Posted February 26, 2017 would you help me regarding specific same layer want to delete multiple drawings (Plot Boundary) how I can remove the plot boundary all multiple drawings) Quote Link to comment Share on other sites More sharing options...
abra-CAD-abra Posted February 27, 2017 Share Posted February 27, 2017 This thread may be of interest: https://www.theswamp.org/index.php?topic=40745.msg460267#msg460267 Thanks to Lee Mac 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.