home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / cad_util / v8n7_cad.zip / WRITEINF.LSP < prev   
Lisp/Scheme  |  1993-07-26  |  894b  |  27 lines

  1. (defun C:WRITEINFO ()
  2. ; filter all text entities that have "COSTLY_INVENTORY" 
  3. ; Xdata attached
  4.   (setq xss (ssget "X" '((0 . "TEXT") (-3 ("COSTLY_INVENTORY")))))
  5. ; create ASCII file
  6.   (setq f (open "XDATA.TXT" "w"))
  7. ; initialize counter and repeat through selection set
  8.   (setq i 0)
  9.   (repeat (sslength xss)
  10.     (setq elist (entget (setq ename (ssname xss i)) '("COSTLY_INVENTORY")))
  11. ; prepare each record's fields─roomno, blname, partno
  12.     (setq roomno (cdr (assoc 1 elist))
  13.           xlist (cadr (assoc -3 elist))
  14.           ei 2)
  15.     (while (< ei (length xlist))
  16.       (setq blhand (cdr (nth (1- ei) xlist))
  17.             blname (cdr (nth ei xlist))
  18.             blptno (cdr (nth (1+ ei) xlist)))
  19.       (write-line (strcat roomno "," blhand "," blname "," blptno) f)
  20.       (setq ei (+ 3 ei))
  21.     ); close while
  22.     (setq i (1+ i))
  23.   ); repeat
  24.   (close f)
  25.   (prin1)
  26. )
  27.