Checking if a Block can be Purged

Discussion in 'AutoCAD' started by Razoo, Nov 23, 2009.

  1. Razoo

    Razoo Guest

    Can anyone tell me how to establish whether a block (in an AutoCAD14
    drawing) is available for purging using AutoLisp?

    I can use 'tblsearch' to check the block exists in the drawing database, and
    I can use 'ssget' to establish if the block is inserted directly into the
    drawing.

    (if (and (tblsearch "BLOCK" bname)
    (not (ssget "X" (cons '(0 . "INSERT") (list (cons 2 bname)))))
    )
    (command "PURGE" "B" bname)
    )

    Unfortunately the lisp routine fails if the block is inserted into the
    drawing as a nested (embedded) block because 'ssget' doesn't find it.

    Basically, I need to know whether the block is inserted into the drawing
    either directly, or indirectly as a nested (embedded) block. Is there an
    entity code or similar that will tell me this?

    TIA,
     
    Razoo, Nov 23, 2009
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.