AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN


Listing Symbols

The following will give you a list of all entries in a symbol table. This is
great for creating a list to populate a list box in DCL. 

;;;Start Coding Here

(defun tablelist (s / d r)
	(while 
		(setq d (tblnext s (null d)))
		(setq r (cons (cdr (assoc 2 d)) r))
	);while
);defun

;;;End Coding Here

For example, if you would like a list of all layers in a specific drawing,
use this :

(setq all_layers (tablelist "LAYER"))

AutoLisp should return something like this :

("7" "6" "5" "4" "3" "2" "0")

To populate a list box with the key of "selections," use this :

(start_list "selections")

(mapcar 'add_list all_layers)

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website