编写autolisp程序

编写autolisp程序并通过visual lisp集成开发环境调试该程序
:程序文件名为drawing.lsp,程序中定义了函数drawing,用于根据用户指定的圆心位置和半径绘一个基圆和与该圆同心的另外三个圆,这三个圆的半径依次是与其相邻的前一个圆半径的1.2倍。
本人急需

(defun c:drawing()
(setvar "cmdecho" 0)
(setq ptcenter (getpoint "\n请输入圆心位置:"))
(setq dist(getdist "\n请输入基圆半径:"))
(command "_circle" ptcenter dist)
(command "_circle" ptcenter (* dist 1.2) )
(command "_circle" ptcenter (* dist 1.2 1.2) )
(command "_circle" ptcenter (* dist 1.2 1.2 1.2) )
(princ)
)

再保存为drawing.lsp就OK了...
温馨提示:内容为网友见解,仅供参考
第1个回答  2010-11-16
(Defun c:draw ( / cmd pot rad rai )
(setq cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(if (setq pot (getpoint "\n请选择圆心=>"))
(if (setq rad (getdist pot "\n请输入基圆半径: "))
(repeat 4
(if (null rai) (setq rai rad) (setq rai (* rai 1.2)) )
(command "_.Circle" pot rai)
)
(princ "\n未输入圆半径,退出")
)
(princ "\n未选择圆心,退出")
)
(setvar "cmdecho" cmd) (princ)
)

保存为drawing.lsp就行了
第2个回答  2010-11-11
你先学下vb再看下cad二次开法书就行了
相似回答