autolisp提问我写了这么点语句然后加载
(defundtr(a)(*a(/pi180.0)))(defunc:trgcir(/p1p2p3R1R2X1X2dang)(setvar"cmdecho"0)(grap...
(defun dtr (a)
(* a (/ pi 180.0))
)
(defun c:trgcir(/ p1 p2 p3 R1 R2 X1 X2 d ang)
(setvar "cmdecho" 0)
(graphscr)
(setq R1 (getdist "输入小圆半径"))
(setq R2 (getdist "大圆半径"))
(setq p0 (getpoint "小圆圆心"))
(setq d (getdist "两圆圆心距"))
(setq X1 (+ R1 R2))
(setq X2 (sqrt (- (* d d) (* (+ R1 R2) (+ R1 R2)))))
(setq ang (atan (/ X2 X1)))
(setq p1 (polar p0 0 d))
(setq p3 (polar p0 ang R1))
(setq p2 (polar p1 (+ (dtr 180) ang) R2))
(command "line" p2 p3 "")
(setvar "cmdecho" 1)
(princ)
)
可以画出线的,然后我在(command "line")这行下面添了
(command "circle" p0 R1)
然后就出错了。
请问这是怎么回事啊? 展开
(* a (/ pi 180.0))
)
(defun c:trgcir(/ p1 p2 p3 R1 R2 X1 X2 d ang)
(setvar "cmdecho" 0)
(graphscr)
(setq R1 (getdist "输入小圆半径"))
(setq R2 (getdist "大圆半径"))
(setq p0 (getpoint "小圆圆心"))
(setq d (getdist "两圆圆心距"))
(setq X1 (+ R1 R2))
(setq X2 (sqrt (- (* d d) (* (+ R1 R2) (+ R1 R2)))))
(setq ang (atan (/ X2 X1)))
(setq p1 (polar p0 0 d))
(setq p3 (polar p0 ang R1))
(setq p2 (polar p1 (+ (dtr 180) ang) R2))
(command "line" p2 p3 "")
(setvar "cmdecho" 1)
(princ)
)
可以画出线的,然后我在(command "line")这行下面添了
(command "circle" p0 R1)
然后就出错了。
请问这是怎么回事啊? 展开
1个回答
展开全部
"line"画线命令,是需要用户结束的,意思就是,你下了这命令后,可能取两点画一线,或是三点画两条线,不确定的,所以程序要求用户自己结束命令 "" 就是这两点。
而你(command "line")后直接(command "circle" p0 R1)这样肯定会出错,建议改为 (command "line" pause pause "") (command "circle" p0 R1) 这样,程序执行时会在LINE命令这里暂停,等用户输入两个点后,再进行下面的操作。
而你(command "line")后直接(command "circle" p0 R1)这样肯定会出错,建议改为 (command "line" pause pause "") (command "circle" p0 R1) 这样,程序执行时会在LINE命令这里暂停,等用户输入两个点后,再进行下面的操作。
追问
那怎么能再继续画线呢?
追答
(command "line" pause pause "")
(command "circle" p0 R1)
这样就可以了,画线,程序会要求输入两个点 就是两个pause 暂停的作用
再进行下面的画圆。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询