Tharwat 发表于 2022-7-6 11:46:19

你好
我已将和更改为等于零,但它宣布了一个错误。
(defun c:Try (/ fname tx pt)
(if (findfile "c:/try.txt")
   (setq fname (open "c:/try.txt" "r"))
    (alert "FILE NOT FOUND!"));; This alert is suppressed to command line
(repeat 16 (setq tx (read-line fname)));;; Text is not avaliable in reallity
(if (eqtx nil);;; What's the right action in here
         (progn
            (alert "TEXT NOT EXISTED") This alert is suppressed to command line
            (princ))
          (setq pt (getpoint "\nText location : "))
                                 )
                  (entmakex (list '(0 . "TEXT")
                            (cons 40 (getvar 'textsize))
                            (cons 1 tx)
                            (cons 10 (trans pt 1 0))))   
(princ)
)

 
谢谢
塔瓦特

alanjt 发表于 2022-7-6 11:53:06

(defun c:Try (/ fo tx pt)
(if (findfile "c:/try.txt")
   (progn
   (setq fo (open "c:/try.txt" "r"))
   (repeat 5 (setq tx (read-line fo)))
   (close fo)
   (if (eq (type tx) 'STR)
       (if (setq pt (getpoint "\nText location : "))
         (entmakex (list '(0 . "TEXT")
                         (cons 40 (getvar 'textsize))
                         (cons 1 tx)
                         (cons 10 (trans pt 1 0))
                   )
         )
       )
       (alert "Text line empty.")
   )
   )
   (alert "File not found.")
)
(princ)
)
页: 1 [2]
查看完整版本: (读取行)