Executive Delete

Discussion in 'AutoCAD' started by SAM90, Aug 26, 2004.

  1. SAM90

    SAM90 Guest

    I'll try here then...

    Does anybody know of a macro that will unlock a layer, delete the item(s) picked then lock the layer again?

    TIA
     
    SAM90, Aug 26, 2004
    #1
  2. SAM90

    Matt W Guest

    Sure...

    (defun C:DeleteObjects ( / a len cnt layName)
    (setq a (ssget))
    (setq len (sslength a))
    (setq cnt 0)
    (repeat len
    (setq e (ssname a cnt))
    (setq layName (cdr (assoc 8 (entget (ssname a cnt)))))
    (princ (strcat "\n " layName))
    (command "-layer" "u" layName "")
    (command "erase" e "")
    (command "-layer" "lo" layName "")
    (setq cnt (+ cnt 1))
    )
    (princ (strcat "Done erasing objects! \n\nTo restore objects to their
    original state, type 'UNDO' - "(rtos len)))
    (princ)
    )

    --
    Matt W

    The difference between genius and stupidity is that genius has its limits.

    | I'll try here then...
    |
    | Does anybody know of a macro that will unlock a layer, delete the item(s)
    picked then lock the layer again?
    |
    | TIA
     
    Matt W, Aug 26, 2004
    #2
  3. SAM90

    Matt W Guest

    Oops!
    Forgot what NG I was in.
    Anyhoo... It'll work, it's just not written in VBA.

    If you need it in VBA, I can re-write it.

    --
    Matt W

    The difference between genius and stupidity is that genius has its limits.
    | Sure...
    |
    | (defun C:DeleteObjects ( / a len cnt layName)
    | (setq a (ssget))
    | (setq len (sslength a))
    | (setq cnt 0)
    | (repeat len
    | (setq e (ssname a cnt))
    | (setq layName (cdr (assoc 8 (entget (ssname a cnt)))))
    | (princ (strcat "\n " layName))
    | (command "-layer" "u" layName "")
    | (command "erase" e "")
    | (command "-layer" "lo" layName "")
    | (setq cnt (+ cnt 1))
    | )
    | (princ (strcat "Done erasing objects! \n\nTo restore objects to their
    | original state, type 'UNDO' - "(rtos len)))
    | (princ)
    | )
    |
    | --
    | Matt W
    |
    | The difference between genius and stupidity is that genius has its limits.
    |
    | | | I'll try here then...
    | |
    | | Does anybody know of a macro that will unlock a layer, delete the
    item(s)
    | picked then lock the layer again?
    | |
    | | TIA
    |
    |
     
    Matt W, Aug 26, 2004
    #3
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.