Forced delete (embedded) block
HELLO,i`AM LOOKING FOR A LISP TO FORCE DELETE A (EMBEDDED)BLOCK FROM A DRAWING. SOMETHING LIKE LAYER DELETE.
THANKS
JAAP Purge command with Block option?
Are the blocks named or anonymous? Check this out .....
(defun c:test (/ ss ss1 e Blks) ; Tharwat 17. 02. 2011 (if (and (setq ss (ssget "_+.:S" '((0 . "INSERT")))) (setq ss1 (ssname ss 0)) (setq e (entget ss1)) ) (progn (setq Blks (ssget "_x" (list '(0 . "INSERT") (cons 2 (cdr (assoc 2 e)))))) (command "_.Erase" Blks "") ) (princ) ) (princ) )
Tharwat NO, IS NOT WORKING. WHEN I GIVE THE COMMAND "TEST". IT ASKS TO SELECT.-->
NOTHING IS DONE. AUTOCAD COMES BACK WITH: Command: TEST Unknown command "TEST".Press F1 for help.
WORKING WITH AUTOCAD ELECTRICAL 2010
JAAP On the contrary , It does the job quickly .
But with your Electrical version of Cad which is I have no idea if would except Lisp or not though .
Sounds like you haven't loaded the lisp correctly, see these instructions.
Also, please stop with the caps, being shout at is not fun. You may want to reconsider this line:
For fun, here's another option:
(defun c:FOO(/ *acadDoc* eName ss blockItem) (vl-load-com) (vla-startundomark (setq *acadDoc* (vla-get-activedocument (vlax-get-acad-object)))) (if (and (setq eName (car (entsel "\nSelect the Block You Wish to Delete: "))) (setq ss (ssget "_x" (list '(0 . "INSERT") (assoc 2 (entget eName)))))) (progn (vlax-for x(setq ss (vla-get-activeselectionset *acadDoc*)) (cond (blockItem) ((setq blockItem (vla-item (vla-get-blocks *acadDoc*) (vla-get-effectivename x))))) (vla-delete x)) (vla-delete blockItem) (vla-delete ss))) (vla-endundomark *acadDoc*) (princ))
Option #2 will also remove the block reference from the blocks collection. Always cracks me up when I see that. Hello Renderman .
I guess that the following two lines are the same according to the use of them .
(cons 2 (cdr (assoc 2 e)))(assoc 2 e)
But for the situation of building the search filtering list , the cons might be better than(assoc 2 e) What you think ?
You'll laugh, I always try to say it nicely... because I know there's one coming around the corner, pointed at me.
页:
[1]
2