PDA

View Full Version : Alphabetize a List


madcadder
2005-05-17, 05:21 PM
Is there a was to alphabetize this list before it is written to a text file?

Thanks,
Tod


(defun C:XREF_LIST (/ B BLKNAME BLOCKL z)
(vl-load-com)
(setq DWG_NAME (strcat (getvar "dwgprefix")(vl-filename-base (getvar "dwgname")) ".TXT")
z (open DWG_NAME "w")
B 0
FIRST 1
)
(while B
(if FIRST
(setq BLOCKL (tblnext "block" 1)
FIRST nil
)
(setq BLOCKL (tblnext "block"))
)
(if (= BLOCKL nil)
(progn
(setq B nil)
(close z)
)
(if (assoc 1 BLOCKL)
(write-line (cdr (assoc 1 BLOCKL)) z)
)
)
)
(princ)
)

scwegner
2005-05-17, 05:45 PM
Yup, using (acad_strlsort list)