AutoCAD软件中通过Visual Lisp设计一个参数化画轴的命令。通过命令(hgz x1 d1 x2 d2 x3 d3)能够首先提示设置基点P0,然后自动完成类似下图的CAD图自动绘制
时间: 2024-05-26 22:12:41 浏览: 172
实现代码如下:
(defun c:hgz (/ p0 x1 d1 x2 d2 x3 d3)
(setq p0 (getpoint "\n设置基点P0: "))
(setq x1 (getreal "\n输入x1: "))
(setq d1 (getreal "\n输入d1: "))
(setq x2 (getreal "\n输入x2: "))
(setq d2 (getreal "\n输入d2: "))
(setq x3 (getreal "\n输入x3: "))
(setq d3 (getreal "\n输入d3: "))
(command "line" p0 (list (+ x1 d1) (cdr p0)))
(command "line" (list (+ x1 d1) (cdr p0)) (list (+ x2 d2) (cdr p0)))
(command "line" (list (+ x2 d2) (cdr p0)) (list (+ x3 d3) (cdr p0)))
(princ)
)
运行命令后按提示输入参数,即可绘制出相应的轴。
阅读全文