-
- ;;; its a sub-function for the bigger program
- ;;; when it is called you need to pass it 2 variables example: (cdrs 10 and the polyline list from the autolisp entget function)
- ;;; the variable KEY is the first item in a dotted pair like (10 100.500 200.600)
- ;;; the variable LST is the list of entity information like if you use (entget(entlast))
- (defun cdrs (key lst / pair rtn)
- ;_while pair is not nil loop.
- (while (setq pair (assoc key lst)); pair = the first occurrence of the key item in the list
- (setq rtn (cons (cdr pair) rtn);_a list of the items are being made
- lst (cdr (member pair lst));_remaking the list to be passed back on the next loop
- ;;;with out the previous (assoc key lst) so it will get thew next item in the list
- );_setq
- );_while
- (reverse rtn);_flip the list so the fitst item the while loop retrives is now the first in the list
- );_defun
- ;;; this sub-function can be tested by the following call
- ;;; first draw a polyline then make the call
- (cdrs 10 (entget(entlast)))
|