- 积分
- 34512
- 明经币
- 个
- 注册时间
- 2002-11-20
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-6-13 11:35:00
|
显示全部楼层
还有一些小问题
本帖最后由 meflying 于 2003-6-13 11:35:33 编辑
是meflying,不是myflying,我擅自改了一下,哈哈。。。
首先你到底要输入几点,是文件中的点都全部输入,还是以某种方式结束输入,另外就是我上次说过了,如果H不同,是不可以用PLINE的,我改用了LINE,结束输入点方式以一个空回车结束。程序没有做出错处理。
(defun read_l(str / n i slist stmp stmp2 slist in)
(setq n (strlen str))
(setq i 1)
(setq in nil)
(setq slist nil)
(while (<= i n)
(while (and (< i n) (/= (setq stmp (substr str i 1)) ","))
(if (not in) (setq stmp2 stmp))
(setq in t)
(setq i (1+ i))
(setq stmp2 (strcat stmp2 (substr str i 1)))
)
(if in (progn
(setq slist (append slist (list (atoi (vl-string-right-trim "," stmp2)))))
(setq in nil))
)
(setq i (1+ i))
)
slist
)
(defun read_f(fname index)
(setq f (open fname "r"))
(setq str (read-line f))
(repeat index
(setq str (read-line f))
)
str
)
(defun c:drawline( / fname n i str str_start str_end strDxf)
(setq fname "d:\\abc.txt")
(setq n 1)
(setq i 1)
(while n
(setq n (getint (strcat "第" (itoa i) "点代码:")))
(setq i (1+ i))
(if n
(setq str (append str (list (read_f fname n))))
)
)
(setq n (length str))
(setq i 1)
(setq str_start (cdr (read_l (nth 0 str))))
(while (< i n)
;;; (setq x_start (nth 0 str_start))
;;; (setq y_start (nth 1 str_start))
;;; (setq h_start (nth 2 str_start))
(setq str_end (cdr (read_l (nth i str))))
;;; (setq x_end (nth 0 str_end))
;;; (setq y_end (nth 1 str_end))
;;; (setq h_end (nth 2 str_end))
(setq strDxf '((0 . "LINE") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine")))
(setq strDxf (append strDxf (list (cons 10 str_start) (cons 11 str_end) '(210 0.0 0.0 1.0))))
(entmake strDxf)
(setq str_start str_end)
(setq i (1+ i))
)
(princ)
) |
|