Jump to content
Bobzy20

Remove all 3DSolids within Blocks Script

Recommended Posts

Bobzy20

Hi

 

Does anybody know of a script for AutoCAD 2012 that will remove all 3DSolids within a drawing even if they are nested within a block/s?

 

Any help would be great

 

Thanks

 

Bob

Share this post


Link to post
Share on other sites
Roy_043

This can't be done with a script (*.scr). But a Lisp solution is possible:

(defun c:Test ( / doc)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)))
 (vla-endundomark doc)
 (vla-startundomark doc)
 (vlax-for blk (vla-get-blocks doc)
   (vlax-for obj blk
     (if (= "AcDb3dSolid" (vla-get-objectname obj))
       (vla-delete obj)
     )
   )
 )
 (vla-endundomark doc)
 (princ)
)

Share this post


Link to post
Share on other sites
BIGAL

Add this before the (princ) to remove other solids

 

(setq ss (ssget "X" (list (cons 0 "3dSolid"))))
(command "erase" ss "")

Share this post


Link to post
Share on other sites
Bobzy20

Thank you both for your help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×