Bobzy20 Posted November 20, 2015 Share Posted November 20, 2015 Hi I'm looking for a lisp routine to delete all wipeouts within Model space. It would need to delete wipeouts within blocks also. Does anybody know of such a lisp already out there? Thanks Bob Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 20, 2015 Share Posted November 20, 2015 Hi Bob, Try the routine in the following link and just replace the object name "AcDbHatch" with "AcDbWipeout". THIS LINK and to delete the Wipeout from the Model space , just add the following codes to the previous program: (if (setq ss (ssget "_X" '((0 . "WIPEOUT")(410 . "Model")))) (command "_.erase" ss "") ) Good luck. Quote Link to comment Share on other sites More sharing options...
kpblc Posted November 21, 2015 Share Posted November 21, 2015 http://autolisp.ru/wp-content/uploads/2013/11/erase-wipeout.lsp Command to start: erase-wipeout Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted November 21, 2015 Share Posted November 21, 2015 Another method (defun C:DELWP ( / *error*) (vl-load-com) ;;;(setq *error* (err)) (vlax-for block (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (not (eq (vla-get-isxref block) :vlax-true)) (vlax-for obj block (if (eq (vla-get-objectname obj) "AcDbWipeout") (vla-delete obj) ) ) ) ) ;;;(*error* nil) (princ) ) Quote Link to comment Share on other sites More sharing options...
kpblc Posted November 21, 2015 Share Posted November 21, 2015 You forget about frozen and locked layers. Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted November 21, 2015 Share Posted November 21, 2015 You forget about frozen and locked layers. No, but I'm lazy. Here, also a lazy solution: (vl-catch-all-apply 'vla-delete (list obj)) Quote Link to comment Share on other sites More sharing options...
Bobzy20 Posted November 21, 2015 Author Share Posted November 21, 2015 Thanks for the codes everyone, Tharwat one seemed to work ok. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 23, 2015 Share Posted November 23, 2015 Just keep 1 post going rather than multiple post questions. See your other post, Maybe ask administrator to merge into 1. Quote Link to comment Share on other sites More sharing options...
Bobzy20 Posted November 23, 2015 Author Share Posted November 23, 2015 Thanks, will do. They started off as two separate requests but then I thought why not combine into one piece of juicy code. Who is an administrator on here? Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 9, 2016 Share Posted August 9, 2016 Hi Tharwart, I know it is an old thread.... but I didn't understand how you would implement this snipped into the whole routine. (if (setq ss (ssget "_X" '((0 . "WIPEOUT")(410 . "Model")))) (command "_.erase" ss "") ) Could you please show me the secret ? kind regards Quote Link to comment Share on other sites More sharing options...
kpblc Posted August 9, 2016 Share Posted August 9, 2016 try to use sssetfirst before calling erase command. P.S. chek the difference between command and command-s Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 9, 2016 Share Posted August 9, 2016 Hi Tharwat, I know it is an old thread.... but I didn't understand how you would implement this snipped into the whole routine. (if (setq ss (ssget "_X" '((0 . "WIPEOUT")(410 . "Model")))) (command "_.erase" ss "") ) Could you please show me the secret ? kind regards Can you be more specific to the point? I did not get what you want. Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 9, 2016 Share Posted August 9, 2016 Hi Tharwart, you wrote under #2 answer this: Hi Bob, Try the routine in the following link and just replace the object name "AcDbHatch" with "AcDbWipeout". THIS LINK and to delete the Wipeout from the Model space , just add the following codes to the previous program: (if (setq ss (ssget "_X" '((0 . "WIPEOUT")(410 . "Model")))) (command "_.erase" ss "") ) Good luck. ... and I tried to figure out how I can implement this, but I failed. Could you please show me how to do that? (vl-load-com) (defun c:Test (/ b o) ;;--- Tharwat 26.June.2013 ---;; (or doc (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ) (vlax-for b (vla-get-blocks doc ) (if (and (eq :vlax-false (vla-get-isLayout b)) (eq :vlax-false (vla-get-isXref b)) ) (vlax-for o b (if (eq "[color="red"]AcDbWipeout[/color]" (vla-get-objectname o)) (vl-catch-all-apply 'vla-delete (list o)) ) ) ) ) [color="red"] (if (setq ss (ssget "_X" '((0 . "WIPEOUT")(410 . "Model")))) (command "_.erase" ss "") )[/color] (vla-regen doc acAllViewports) (princ) ) ... this is my stupid try .... kind regards Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 9, 2016 Share Posted August 9, 2016 First it would be nice if you pay more attention to my name and how to write it correctly. Secondly what was the error message with that mods? Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 9, 2016 Share Posted August 9, 2016 I'm sorry..... Tharwat.... it wasn't on purpose... I didn't get any error message. I got nothing. I tried also to run the snippet like this: (defun c:Test_Wiepeout() (if (setq ss (ssget "_X" '((0 . "WIPEOUT")(410 . "Model")))) (command "_.erase" ss "") ) ) .. and it worked perfect. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 9, 2016 Share Posted August 9, 2016 So which one that doesn't work ? the one for blocks or the one for wipeouts in Model space? Upload a sample drawing of the same one you are trying on the codes if possible. Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 9, 2016 Share Posted August 9, 2016 each separately work perfect, but I didn't get it together. If I tried -see above post #13- it work only for Blocks. Wipeout_Test.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 9, 2016 Share Posted August 9, 2016 It works here perfectly. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 9, 2016 Share Posted August 9, 2016 Are you using the English version of AutoCAD? Maybe the command name erase is meant to be different if you are using none English version. just a guess. Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 9, 2016 Share Posted August 9, 2016 I FOUND THE MISTAKE !!! ... I'm sorry, for wasting you time .... I had both routines (the one with only for Blocks and the one for Blocks and Model space) into one file and both are named "Test". ... a typical beginner's mistake .... You are right, it work perfect. 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.