ljpnb发表于2005-4-21 7:59:00试试,写得很常规的思路,当中可以简化一下: ;;;主程序开始(defun c:test () (SETQ F_ID (OPEN \"C:data.TXT\" \"r\")) (setq os (getvar \"osmod... 简化后的程序:- (defun c:test ()
- (SETQ F_ID (OPEN "C:data.TXT" "r"))
- (setq os (getvar "osmode"))
- (setvar "cmdecho" 0)
- (setvar "osmode" 0)
- (while (SETQ text0 (READ-LINE F_ID))
- (SETQ TEXTL (READ (STRCAT "(" TEXT0 ")")))
- (SETQ TL (/ (LENGTH TEXTL) 2))
- (SETQ I 0)
- (REPEAT TL
- (SETQ PP (READ (STRCAT "P" (ATOI (1+ I)))))
- (SET PP (LIST (NTH (+ I I) TEXTL) (NTH (+ 1 I I) TEXTL)))
- (SETQ I (1+ I))
- )
- (command "pline" p1 "a" "s" p2 p3 "l" p4 "a" "s" p5 p6 "l" "c")
- )
- (CLOSE F_ID)
- (setvar "osmode" os)
- (setvar "cmdecho" 1) (princ)
- )
|