Jump to content

Delete all Wipeouts within a Drawing including Blocks


Recommended Posts

Posted

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

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

  • Tharwat

    12

  • masterfal

    10

  • kpblc

    8

  • Bluebird1973

    5

Top Posters In This Topic

Posted Images

Posted

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.

Posted

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)
 )

Posted
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))

Posted

Thanks for the codes everyone, Tharwat one seemed to work ok.

Posted

Just keep 1 post going rather than multiple post questions. See your other post,

 

Maybe ask administrator to merge into 1.

Posted

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?

  • 8 months later...
Posted

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

Posted

try to use sssetfirst before calling erase command.

P.S. chek the difference between command and command-s

Posted
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.

Posted

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

Posted

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?

Posted

I'm sorry..... Tharwat.... it wasn't on purpose... :cry:

 

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.

Posted

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.

Posted

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

Posted

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.

Posted

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 .... :x

 

You are right, it work perfect.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...