谢谢米尔恰,但这似乎也不起作用。我出错了
- (defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln)
- (setvar "cmdecho" 0)
- (prompt "\nlook at end of line")
- ;(setq chekdfile (getstring "enter name of file :"))
- (SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4))
- (setq opf (open chekdfile "r"))
- (setq bkt 0)
- (setq blkl 0)
- (setq rdctl 1)
- (setq wkfile (open "c:\\acadtemp\\wow.lsp" "w"))
- (setq currentln "a")
- (while (/= blkl 6)
- (setq currentln (read-line opf))
- (if (= currentln nil)(setq currentln ""))
- (if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1))
- (setq wln currentln)
- (while (/= wln "")
- (setq ltr (substr wln 1 1))
- (setq wln (substr wln 2))
- (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0)))
- ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1)))
- ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1)))
- ((and (= ltr ";")(= rdctl 1))(setq wln ""))
- ;(t (prompt ltr))
- )
- )
- (setq ncln (strcat currentln ";" (itoa bkt)
- (princ (itoa bkt))
- (if (= rdctl 0) "string open" "")))
- (if (/= currentln "")(write-line ncln wkfile))
- )
- (close wkfile)
- (close opf)
- (prompt (strcat "open brakets= " (itoa bkt) "."))
- )
- (setq ang1 nil
- pt1 nil
- pt2 nil
- pt3 nil
- pt4 nil
- pt5 nil)
- (princ)
运行appload时。 |