我正在尝试使用lisp生成函数。我想做两条偏移线,它们与中心线等距分布。
所以我把这个函数命名为testpipe。
管径和管道长度由用户输入,线将通过极坐标计算创建。
但此功能可以加载到Autocad,但无法运行并显示“错误输入”
你能告诉我这个lisp文件有什么问题吗?
- ;pipe outerline function
- (defun c:testpipe ()
- ;get user input
- ;get pipe diameter, and starting and ending point
- (setq pd (getdist "\nPipe diameter:"))
- (setq a (getdist "\nPipe distance:"))
- ;get insertion point
- (setq ip (getpoint "\nInsertion point"))
- ;start polar calculation
- (setq p2 (polar ip (dtr 90) (/ pd 2)))
- (setq p3 (polar p2 (dtr 0) a))
- (setq p4 (polar p3 (dtr 270) pd))
- (setq p5 (polar p4 (dtr 180) a))
- (setq p6 (polar p5 (dtr 90) (-(/ pd 2)))
- ;command
- (command "line" ip p2 p3 p4 p5 p6 "c"
- )
- (princ)
- ;finish cleanly
- ) ;end of defun
- ;define function dtr
- (defun dtr (x)
- ;define degrees to radians function
- (* pi (/ x 180.0))
- ;divide the angle by 180 then
- ;multiply the result by the constant PI
- ) ;end of function
- (princ) ;load cleanly
|