Jump to content

Delete all Wipeouts within a Drawing including Blocks


Bobzy20

Recommended Posts

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

Link to comment
Share on other sites

  • 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

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 8 months later...

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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