是不是把他们全都设成全局变量呢? 先看下面这个,要看完了,,,http://bbs.mjtd.com/forum.php?mod=viewthread&tid=21383再看我给你改的程序。。。注意,你的程序,最后command部分是错误的,所以程序无法完成,这部分我未改,注意subtract命令的用法。。。(defun jiansuo (ct / f1 p)
(setq f1 (open "e:\\abc.txt" "r"))
(repeat ct
(setq p (read (read-line f1)))
)
(close f1)
p
)
(defun c:luos1 (/ lst item l d ct p p1 ent_p ent_c)
(setq lst '((10 20 200) (12 25 260) (14 25 260) (16 30 300) (18 35 300)
(20 35 300) (22 50 300) (24 55 300) (27 60 300) (30 60 300)
(36 80 300) (42 80 300) (48 110 300) (56 160 380) (64 180 380)
(72 180 380) (80 200 380)(90 220 500) (100 220 500)))
(while (not (assoc (setq d (getreal "\n请输入螺栓的直径:")) lst)))
(setq item (assoc d lst))
(setq l (getreal (strcat "\n请输入螺栓的长度在" (rtos (cadr item)) "到" (rtos (last item)) "之间:")))
(if (and (> l (- (cadr item) 0.01)) (< l (- (caddr item) 0.01)))
(progn
(setq ct (1+ (- (length lst) (length (member item lst)))))
(setq lst (jiansuo ct))
(cond ((< l 125.01) (setq l0 (+ (* d 2) 6)))
((or (> l 125) (< l 200.01)) (setq l0 (+ (* d 2) 12)))
((> l 200) (setq l0 (+ (* d 2) 25)))
)
(setq p (getpoint "\n请输入图形的插入点:"))
(command "polygon" 5 p "c" (nth 0 lst))
(setq ent_p (entlast))
(command "subtract" ent_p "" (nth 1 lst) "")
(setq p1 (list (car p) (cadr p) (nth 1 lst)))
(command "ucs" "n" p1)
(command "circle" p1 d)
(setq ent_c (entlast))
(command "subsrtact" ent_c "" l "")
)
)
(princ)
) 多谢大侠拔刀相助。我会常来看你的
呵呵 呵呵我在拉伸的时候用了subtract本来想用extrude
页:
1
[2]