Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

*Expert Elite*
Posts: 2,459
Registered: ‎11-24-2009
Message 11 of 11 (308 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:"))




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 or visit the Installation and Licensing Forum to get help installing your software.