我为你编了一个小程序用于A2K以上版本,用法是:
1、你可以建一个文件按上面你说的格式写好存盘为*.txt,文件中的逗号要用半角的逗号“,”!!
2、加载我下面的程序。
3、在COMMAND下键入read_txt,就能解决好了。
4、注意事项。字形为当前字形,字高为当前字高,所画的点为DONUT命令所画,如果你想调整所画点的大小,你可先用DONUT命令画一个再删除它不能用UNDO删除!所标标高与点之间的距离为DONUT的最大半径加上字高的一半。
 - (defun c:read_txt (/ file_txt loop txt_xyz fil
- x y z xy yz xyz x_len
- l_len pt
- )
- (setq file_txt (getfiled "Read TXT File" " " "txt" 8)
- loop t
- txt_xyz nil
- )
- (vl-load-com)
- (setvar "CMDECHO" 0)
- (command "_.undo" "a" "off" "_.undo" "g")
- (if file_txt
- (progn
- (setq fil (open file_txt "r"))
- (while loop
- (setq xyz (read-line fil))
- (if (not xyz)
- (progn (close fil) (setq loop nil))
- (setq x_len (vl-string-position (ascii ",") xyz)
- x (substr xyz 1 x_len)
- yz (substr xyz (+ x_len 2))
- y_len (vl-string-position (ascii ",") yz)
- y (substr yz 1 y_len)
- z (substr yz (+ y_len 2))
- xy (list (atof x) (atof y))
- xyz (list xy z)
- txt_xyz (cons xyz txt_xyz)
- )
- )
- )
- (foreach pt txt_xyz
- (command
- "_.doughnut"
- ""
- ""
- (car pt)
- ""
- "_.text"
- (polar (car pt)
- 0.0
- (+ (getvar "donutid") (* 0.5 (getvar "textsize")))
- )
- (getvar "textsize")
- 0.0
- (cadr pt)
- )
- )
- )
- )
- (command "_.undo" "e" "_.undo" "a" "on")
- )
方法二:http://www.xdcad.net/forum/showthread.php?s=&threadid=17582 |