Visual LISP, AutoLISP and General Customization

*Expert Elite*
Posts: 2,406
Registered: ‎11-24-2009
Message 11 of 11 (281 Views)

Re: Lisp routine to delete blocks

06-21-2012 08:13 AM in reply to: jjorovi

a quick mod


(defun c:deleteblock  (/ *error* msge effnme ent entl setl e)
            "warning! - this command deletes all occurences of block selected")
      (defun *error*  (msge)
            (princ "error: ")
            (setq msge (princ "\nfunction cancelled"))
      (setq effnme (lambda (x)
                               (if (eq (type x) 'ENAME)
                                     (vlax-ename->vla-object x)
      (princ "\nselect block to delete: ")
      (if (setq ent (ssget "_:smileyfrustrated:" '((0 . "INSERT"))))
                  (setq entl (effnme (ssname ent 0)))
                  (ssget "x" (list (cons 2 (strcat entl ",`*U*"))))
                         itm  (vla-get-ActiveSelectionSet
                        (if (eq (effnme itm) entl)
                                    (list itm))))
                  (princ (strcat "\nall blocks named "
                                 " have now been deleted")))
            (princ "\nNo Block Selected:"))




You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community