TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TJAM51 on December 19, 2007, 10:06:01 AM
-
This topic is two fold.
1. I have the following lisp routines in one file.
(defun c:deldim (/ ss)
(setq ss (ssget "x" (list (cons 0 "Dimension"))))
(if ss
(command ".erase" ss "")
(princ "\nNo dimensions in this drawing!")
)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:dellead (/ ss)
(setq ss (ssget "x" (list (cons 0 "LEADER"))))
(if ss
(command ".erase" ss "")
(princ "\nNo leaders in this drawing!")
)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:delmtext (/ ss)
(setq ss (ssget "x" (list (cons 0 "mtext"))))
(if ss
(command ".erase" ss "")
(princ "\nNo text in this drawing!")
)
(princ)
)
I would like to have one command to run them in sequence.
2. I have discovered blocks with the names starting with A$. Some will purge and some will not. I would like to be able to rename them and the naming convention is not important. Is there a way to have a lisp rename them with some convention that could drop the dollar sign and maybe leaving the remaining characters.
Thanks
<edit: added code tags- CAB>
-
Here is something to delete all at once.....*edit* will NOT bonk out if objects are on a locked layer:
(defun c:delstuff (/ ss)
(if (setq ss (ssget "x" '((0 . "DIMENSION,LEADER,MTEXT"))))
(mapcar
'(lambda (x)
(if (not (equal (vla-get-lock
(vlax-ename->vla-object
(tblobjname "layer" (vla-get-layer x))
)
)
:vlax-true
)
)
(vla-delete x)
)
)
(mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))
)
)
(princ)
)
-
Hey thanks a lot..
-
Recieved the following error....
error: bad argument type: numberp: nil
-
never mind....when I cut and paste I left off one of the ( :lol:
-
Hey thanks a lot..
Glad to help...I edited the code above to ignore items on locked layers.