MyLsp.lsp
;;;============================================================================;
;; 현재 도면에 로딩된 명령어/함수/변수 기록
;; edit by izzarder
;;;============================================================================;
(defun c:MyLsp (/ A B FILE GETKW LST N TEMP_FILE consp is-command is-function my-princ)
;;;----------------------------------------------------------------------------;
(defun Is-command (a /)
(and
(equal "C:" (substr (xstrcase a) 1 2))
(Is-function (eval (read a)))
)
)
;;;----------------------------------------------------------------------------;
(defun consp (lst)
(not (vl-list-length lst))
)
;;;----------------------------------------------------------------------------;
(defun Is-function (b /)
(or
(and
(= 'LIST (type b))
(not (consp b))
(> (length b) 1)
(or (= 'LIST (type (car b)))
(not (car b))
)
)
(= 'SUBR (type b))
(= 'USUBR (type b))
(= 'EXRXSUBR (type b))
)
)
;;;----------------------------------------------------------------------------;
(defun My-princ (a / c)
(if
(setq c (type (eval (read a))))
(setq c (vl-symbol-name c))
(setq c "nil")
)
(setq c (strcat "(" c ")"))
(if
(= "C:" (substr a 1 2))
(setq a (substr a 3))
)
(while (< (strlen a) 40)
(setq a (strcat a " "))
)
(while (< (strlen c) 20)
(setq c (strcat c " "))
)
(strcat a c)
)
;;;----------------------------------------------------------------------------;
(initget "Commands Functions Variables")
(setq getkw (getkword "\n>> 선택 [Commands/Functions/Variables] <P> </P><VARIABLES>: "))
(setq lst (acad_strlsort (atoms-family 1)))
(setq Temp_File (vl-filename-mktemp nil nil ".txt"))
(setq file (open Temp_File "w"))
(cond
( (= getkw "Commands")
(repeat (setq n (length lst))
(setq a (xstrcase (nth (setq n (1- n)) lst)))
(if (Is-command a)
(write-line (My-princ a) FILE)
)
)
)
( (= getkw "Functions")
(repeat (setq n (length lst))
(setq a (xstrcase (nth (setq n (1- n)) lst)))
(if
(and
(setq b (eval (read a)))
(Is-function b)
)
(write-line (My-princ a) FILE)
)
)
)
( 'T
(repeat (setq n (length lst))
(setq a (xstrcase (nth (setq n (1- n)) lst)))
(setq b (eval (read a)))
(if
(and
(not (Is-function b))
(not (Is-command a))
)
(write-line (My-princ a) FILE)
)
)
)
)
(close FILE)
(startapp "notepad" Temp_File)
(princ)
)