乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: Tharwat

[编程交流] (读取行)

[复制链接]

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 11:46:19 | 显示全部楼层
你好
我已将和更改为等于零,但它宣布了一个错误。
  1. (defun c:Try (/ fname tx pt)
  2. (if (findfile "c:/try.txt")
  3.    (setq fname (open "c:/try.txt" "r"))
  4.     (alert [color="Red"]"FILE NOT FOUND!"[/color]));;[color="red"] This alert is suppressed to command line[/color]
  5. (repeat 16 (setq tx (read-line fname)));;; [color="Red"]Text is not avaliable in reallity[/color]
  6. (if ([color="Red"]eq  tx nil[/color]);;; [color="Red"]What's the right action in here[/color]
  7.            (progn
  8.               (alert "TEXT NOT EXISTED")[color="red"] This alert is suppressed to command line[/color]
  9.               (princ))
  10.           (setq pt (getpoint "\nText location : "))
  11.                                    )
  12.                   (entmakex (list '(0 . "TEXT")
  13.                             (cons 40 (getvar 'textsize))
  14.                             (cons 1 tx)
  15.                             (cons 10 (trans pt 1 0))))     
  16. (princ)
  17. )

 
谢谢
塔瓦特
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 11:53:06 | 显示全部楼层
  1. (defun c:Try (/ fo tx pt)
  2. (if (findfile "c:/try.txt")
  3.    (progn
  4.      (setq fo (open "c:/try.txt" "r"))
  5.      (repeat 5 (setq tx (read-line fo)))
  6.      (close fo)
  7.      (if (eq (type tx) 'STR)
  8.        (if (setq pt (getpoint "\nText location : "))
  9.          (entmakex (list '(0 . "TEXT")
  10.                          (cons 40 (getvar 'textsize))
  11.                          (cons 1 tx)
  12.                          (cons 10 (trans pt 1 0))
  13.                    )
  14.          )
  15.        )
  16.        (alert "Text line empty.")
  17.      )
  18.    )
  19.    (alert "File not found.")
  20. )
  21. (princ)
  22. )
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-6 16:58 , Processed in 0.440809 second(s), 54 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表