Author Topic: Loading small lisp within a larger lisp file - purge block A$SCO____  (Read 2276 times)

0 Members and 1 Guest are viewing this topic.

TJAM51

  • Guest
This topic is two fold.
 
1. I have the following lisp routines in one file.

Code: [Select]
(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>
« Last Edit: December 19, 2007, 10:55:54 AM by CAB »

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Loading small lisp within a larger lisp file - purge block A$SCO____
« Reply #1 on: December 19, 2007, 10:45:56 AM »
Here is something to delete all at once.....*edit* will NOT bonk out if objects are on a locked layer:

Code: [Select]
(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)
)
« Last Edit: December 19, 2007, 11:04:05 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

TJAM51

  • Guest
Re: Loading small lisp within a larger lisp file - purge block A$SCO____
« Reply #2 on: December 19, 2007, 10:50:51 AM »
Hey thanks a lot..

TJAM51

  • Guest
Re: Loading small lisp within a larger lisp file - purge block A$SCO____
« Reply #3 on: December 19, 2007, 10:52:36 AM »
Recieved the following error....


error: bad argument type: numberp: nil

TJAM51

  • Guest
Re: Loading small lisp within a larger lisp file - purge block A$SCO____
« Reply #4 on: December 19, 2007, 10:53:41 AM »
never mind....when I cut and paste I left off one of the ( :lol:

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Loading small lisp within a larger lisp file - purge block A$SCO____
« Reply #5 on: December 19, 2007, 11:04:34 AM »
Hey thanks a lot..

Glad to help...I edited the code above to ignore items on locked layers.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC