home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
cad_util
/
v8n7_cad.zip
/
READINFO.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1993-07-26
|
2KB
|
48 lines
(defun C:READINFO ()
; open the data file
(setq f (open "XDATA.TXT" "r"))
(setq record (read-line f))
(while record
; parse the line for commas and assign variables
(setq i 1 ip 1)
(while (/= (substr record i 1) ",") (setq i (1+ i)) )
(setq roomno (substr record ip (- i ip)) i (1+ i) ip i)
(while (/= (substr record i 1) ",") (setq i (1+ i)) )
(setq blhand (substr record ip (- i ip)) i (1+ i) ip i)
(while (/= (substr record i 1) ",") (setq i (1+ i)) )
(setq blname (substr record ip (- i ip)) i (1+ i) ip i)
(setq blptno (substr record ip))
; filter for text room number with Xdata
(setq ss1 (ssget "X" (list '(0 . "TEXT") (cons 1 roomno)))
elist (entget (setq ename (ssname ss1 0)) '("COSTLY_INVENTORY"))
xlist (cadr (assoc -3 elist)) )
; filter for handles and compare block names
(setq i 1)
(while (< i (length xlist))
(if (= (car (nth i xlist)) 1005)
(progn
(setq oblname (cdr (nth (1+ i) xlist))
bllist (entget (handent (cdr (nth i
xlist)))))
; if block names are different
(if (and (= (cdr (assoc 5 bllist)) blhand)
(/= (cdr (assoc 2 bllist)) blname) )
(progn
(setq xlist (subst blname (cdr (nth (1+ i)
xlist)) xlist))
(setq bllist (subst (cons 2 blname) (assoc 2
bllist) bllist))
(entmod bllist)
) ); if, progn
) ); progn for handle
(setq i (1+ i))
); while xlist
; update the xdata on room number
(setq elist (subst (list -3 xlist) (assoc -3 elist) elist))
(entmod elist)
(setq record (read-line f))
); while record
(close f)
(prin1)
)