Bobzy20 Posted November 20, 2015 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
Tharwat Posted November 20, 2015 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
kpblc Posted November 21, 2015 Posted November 21, 2015 http://autolisp.ru/wp-content/uploads/2013/11/erase-wipeout.lsp Command to start: erase-wipeout Quote
Stefan BMR Posted November 21, 2015 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
kpblc Posted November 21, 2015 Posted November 21, 2015 You forget about frozen and locked layers. Quote
Stefan BMR Posted November 21, 2015 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
Bobzy20 Posted November 21, 2015 Author Posted November 21, 2015 Thanks for the codes everyone, Tharwat one seemed to work ok. Quote
BIGAL Posted November 23, 2015 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
Bobzy20 Posted November 23, 2015 Author 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
Bluebird1973 Posted August 9, 2016 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
kpblc Posted August 9, 2016 Posted August 9, 2016 try to use sssetfirst before calling erase command. P.S. chek the difference between command and command-s Quote
Tharwat Posted August 9, 2016 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
Bluebird1973 Posted August 9, 2016 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
Tharwat Posted August 9, 2016 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
Bluebird1973 Posted August 9, 2016 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
Tharwat Posted August 9, 2016 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
Bluebird1973 Posted August 9, 2016 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
Tharwat Posted August 9, 2016 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
Bluebird1973 Posted August 9, 2016 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
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.