home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 15
/
CD_ASCQ_15_070894.iso
/
vrac
/
mar94cad.zip
/
TIP962A.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1994-02-15
|
4KB
|
123 lines
; TIP962A.LSP: DDELAYER.LSP Delete by Layers (c)1994, Mike Aaly
(defun err (er)
(if (/= er "Function cancelled")
(princ (strcat "\nError: "er)))
(setq er nil)
(setvar "CMDECHO" ocmd)
(setq *error* olderr)
(princ)
)
;
(defun C:DDELAYER (/ olderr ocmd ALL SL id SLL ss)
(setq SLL '())
(setq olderr *error* *error* err)
(setq ocmd (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(while
(setq lsts (cdr(assoc 2 (tblnext "LAYER" (not lsts)))))
(setq ALL (cons lsts ALL))
)
(if (= (type acad_strlsort) 'EXSUBR)
(if (and ALL (>= (getvar "maxsort") (length ALL)))
(setq ALL (acad_strlsort ALL))
)
)
(setq id (load_dialog "DDELAYER"))
(new_dialog "DDELAYER" id)
(mode_tile "accept" 1)
(mode_tile "C_A" 1)
;
(defun Make_List ()
(start_list "SL")
(foreach n ALL (add_list n))
(end_list)
)
;
(defun SEL_ALL ()
(setq CT1 0)
(repeat (length ALL)
(set_tile "SL" (itoa CT1))
(setq CT1 (1+ CT1))
)
(mode_tile "S_A" 1)
(mode_tile "C_A" 0)
(mode_tile "accept" 0)
(SM)
)
;
(defun CLEAR_ALL ()
(set_tile "SL" "")
(mode_tile "C_A" 1)
(mode_tile "S_A" 0)
(mode_tile "accept" 1)
(setq SLL '())
(Make_List)
)
;
(defun Select ()
(SM)
(if (= (length SLL) (length ALL))
(mode_tile "S_A" 1)
(mode_tile "S_A" 0)
)
(if (/= (get_tile "SL") "")
(progn
(mode_tile "accept" 0)
(mode_tile "C_A" 0)
)
(progn
(mode_tile "accept" 1)
(mode_tile "C_A" 1)
)
)
)
;
(defun SM (/ SDL PL ct)
(setq SDL (get_tile "SL") SLL '())
(setq ct 1 PL "" SDL (strcat SDL " "))
(while (/= ct (1+ (strlen SDL)))
(if (/= (substr SDL ct 1) " ")
(setq PL (strcat PL (substr SDL ct 1)))
(progn
(setq SLL (cons (nth (atoi PL) ALL) SLL))
(setq PL "")
)
)
(setq ct (1+ ct))
)
)
;
(Make_List)
(action_tile "SL" "(Select)")
(action_tile "cancel" "(setq SLL '()) (done_dialog)")
(action_tile "S_A" "(SEL_ALL)")
(action_tile "C_A" "(CLEAR_ALL)")
(action_tile "accept" "done_dialog")
(start_dialog)
(unload_dialog id)
(if (/= SLL nil)
(progn
(setq flag nil)
(foreach n SLL
(setq ss (ssget "X" (list (cons 8 n))))
(if (/= ss nil)
(progn
(setq flag T)
(princ (strcat "\nDeleting layer " n))
(command "erase" ss "")
)
)
)
(if flag
(princ "\nDone!")
(princ "\nNothing to delete")
)
)
)
(setvar "CMDECHO" ocmd)
(setq *error* olderr)
(princ)
); end ddelayer.lsp