明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1706|回复: 2

[求助]如何用LISP读取这样格式的数据,并赋值?

[复制链接]
发表于 2003-11-13 16:27:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2003-11-13 17:12:56 编辑

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2003-11-13 18:18:00 | 显示全部楼层
自己看一下


  1. (defun c:Test( / fname f i ch chs lines lst)
  2.   (setq fname (getfiled "Select a Lisp File" "" "txt" 8))
  3.   (setq f (open fname "r"))
  4.   (read-line f)
  5.   (while (setq str (read-line f))
  6.     (setq i 1)
  7.     (setq chs "")
  8.     (while (<= i (strlen str))
  9.       (setq ch (substr str i 1))
  10.       (if (/= ch ",")
  11.         (setq chs (strcat chs ch))
  12.         (progn
  13.           (setq lines (append lines (list (read chs))))
  14.           (setq chs "")
  15.         )
  16.       )
  17.       (setq i (1+ i))
  18.     )
  19.     (setq lines (append lines (list (read chs))))
  20.     (setq lst (append lst (list lines)))
  21.     (setq lines nil)
  22.   )
  23.   (princ lst)
  24.   (princ)
  25. )

发表于 2003-11-16 09:36:00 | 显示全部楼层
喂,我看见你了
交个朋友啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-10-2 10:31 , Processed in 0.170585 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表