- 积分
- 2592
- 明经币
- 个
- 注册时间
- 2004-8-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2005-5-26 17:39:00
|
显示全部楼层
郁闷,传不上去,晕,只是简单的改了改,能实现你的要求了,别的方面自己改吧
(defun c:getdata () (setq bp (getpoint " 基点")) (setq L (getreal "L")) (setq D (getreal "D")) (setq x1 (nth 0 bp)) (setq y1 (nth 1 bp)) (setq p1 (list x1 y1)) (setq p2 (list x1 (+ y1 (+ L L)))) (setq p3 (list (+ x1 L) (+ y1 (+ L L)))) (setq p4 (list (+ x1 L) y1)) (setq p5 (list (+ x1 L) (+ y1 L))) (command "line" p1 p2 "") (command "line" p2 p3 "") (command "ARC" p4 "C" P5 p3 "") (command "line" p4 p1 "") (command "CIRCLE" p5 "D" D "") (PRIN1) (setq st (ssget)) (setq n 0) (setq f (open "c:/data.txt" "w")) (setq len (sslength st)) (while (< n len) (setq e (ssname st n)) (setq el (entget e)) (setq objtype (cdr (assoc 0 el))) (if (= "LINE" objtype) (progn (setq p1-x (nth 0 (cdr (assoc 10 el)))) (setq p1-y (nth 1 (cdr (assoc 10 el)))) (setq p1-z (nth 2 (cdr (assoc 10 el)))) (setq p2-x (nth 0 (cdr (assoc 11 el)))) (setq p2-y (nth 1 (cdr (assoc 11 el)))) (setq p2-z (nth 2 (cdr (assoc 11 el)))) (setq p1 (strcat (rtos p1-x) "," (rtos p1-y) "," (rtos p1-z))) (setq p2 (strcat (rtos p2-x) "," (rtos p2-y) "," (rtos p2-z))) (write-line "l:" f) (write-line "the start point is:" f) (write-line p1 f) (write-line "the end piont is:" f) (write-line p2 f) ) )
(if (= "ARC" objtype) (progn
(setq p-x (nth 0 (cdr (assoc 10 el)))) (setq p-y (nth 1 (cdr (assoc 10 el)))) (setq p-z (nth 2 (cdr (assoc 10 el)))) (setq r (cdr (assoc 40 el))) (setq r (rtos r)) (setq sangle (cdr (assoc 50 el))) (setq sangle (rtos sangle)) (setq eangle (cdr (assoc 51 el))) (setq eangle (rtos eangle)) (setq p (strcat (rtos p-x) "," (rtos p-y) "," (rtos p-z))) (write-line "arc:" f) (write-line "the center piont is:" f) (write-line P f) (write-line "the start angle is:" f) (write-line sangle f) (write-line "the end angle is:" f) (write-line eangle f) (write-line "the radios is:" f) (write-line r f) ) )
(if (= "CIRCLE" objtype) (progn (setq p-x (nth 0 (cdr (assoc 10 el)))) (setq p-y (nth 1 (cdr (assoc 10 el)))) (setq p-z (nth 2 (cdr (assoc 10 el)))) (setq r (cdr (assoc 40 el))) (setq r (rtos r)) (setq p (strcat (rtos p-x) "," (rtos p-y) "," (rtos p-z))) (write-line "circle:" f) (write-line "the center piont is:" f) (write-line P f) (write-line "the radios is:" f) (write-line r f) )
) (setq n (1+ n)) ) (close f) ) |
|