TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Adesu on January 05, 2007, 03:57:02 AM
-
Hi Alls,
if I load global variable in my acad session,and I forgot how many and what her name ,is there a way to search or to find total number and name of global variable.
(setq p1 1)
(setq p2 2)
(setq p3 3)
(setq str "Adesu")
(setq bla ...)
(setq bli ...)
(setq blo ...)
(setq ble ...)
(setq blu ...)
etc....etc
(defun c:to_find_global_variable ()
(setq bla "etc")
bla
bla
bla
(princ (strcat "\nHere your global variable"
"\nNo.1 is " 1?
"\nNo.2 is " 2?
"\nNo.3 is " 3?
"\nNo.4 is " 4?))
(princ)
)
Command: to_find_global_variable
"\nHere your global variable"
"No.1 is p1"
"No.2 is p2"
"No.3 is p3"
"No.4 is str"
etc...
etc...
-
Somehow so
(setq p1 1)
(setq p2 2)
(setq p3 3)
(setq str "Adesu")
(setq bla "bla")
(setq bli "bli")
(defun c:TEST ( / lst)
(setq lst (atoms-family 1))
(foreach sym lst
(if (and (wcmatch sym "P#,STR,BL*")
(not (member (type(eval (read sym))) '(USUBR SUBR)))
)
(progn
(princ (strcat "\nVariable " sym "="))
(princ (eval (read sym)))
)))
(gc)
(princ)
)
It is better to use a unique pattern for variables
(setq Adesu_p1 1)
(setq Adesu_p2 2)
(setq Adesu_p3 3)
(setq Adesu_str "Adesu")
(setq Adesu_bla "bla")
(setq Adesu_bli "bli")
(defun c:TEST ( / lst)
(setq lst (atoms-family 1))
(foreach sym lst
(if (and (wcmatch sym "ADESU_*")
(not (member (type(eval (read sym))) '(USUBR SUBR)))
)
(progn
(princ (strcat "\nVariable " sym "="))
(princ (eval (read sym)))
)))
(gc)
(princ)
)
-
You also might want to take a look at this. Written by our resident genius MP. :kewl:
http://www.theswamp.org/index.php?topic=1445.msg18109#msg18109
-
Hi
Or this
@+
-
Hi VVA,
it's great and what as I looking for,thanks for your help.
Somehow so
(setq p1 1)
(setq p2 2)
(setq p3 3)
(setq str "Adesu")
(setq bla "bla")
(setq bli "bli")
(defun c:TEST ( / lst)
(setq lst (atoms-family 1))
(foreach sym lst
(if (and (wcmatch sym "P#,STR,BL*")
(not (member (type(eval (read sym))) '(USUBR SUBR)))
)
(progn
(princ (strcat "\nVariable " sym "="))
(princ (eval (read sym)))
)))
(gc)
(princ)
)
It is better to use a unique pattern for variables
(setq Adesu_p1 1)
(setq Adesu_p2 2)
(setq Adesu_p3 3)
(setq Adesu_str "Adesu")
(setq Adesu_bla "bla")
(setq Adesu_bli "bli")
(defun c:TEST ( / lst)
(setq lst (atoms-family 1))
(foreach sym lst
(if (and (wcmatch sym "ADESU_*")
(not (member (type(eval (read sym))) '(USUBR SUBR)))
)
(progn
(princ (strcat "\nVariable " sym "="))
(princ (eval (read sym)))
)))
(gc)
(princ)
)