CAD AutoLisp 简单命令编写
修改红色
lisp
(defun C:1()
(setq ss (ssget ":S"))
(command "change" ss "" "p" "C" 1 "")
(princ)
)
(defun C:2()
(setq ss (ssget ":S"))
(command "change" ss "" "p" "C" 2 "")
(princ)
)
(defun C:3()
(setq ss (ssget ":S"))
(command "change" ss "" "p" "C" 3 "")
(princ)
)
优化删除命令
lisp
(defun c:TT()
(setq ss (ssget ":S"))
(command "erase" ss "")
)
优化镜像命令
lisp
(defun c:MI()
(setq ss (ssget ":S"))
(setq pt1 (getpoint "\n 请捕捉第一点"))
(setq pt2 (getpoint pt1 "\n 请捕捉第二点"))
(command "mirror" ss "" pt1 pt2 "N")
(princ)
)
修改对象图层
lisp
(defun C:yzxx()
(command "change" (ssget) "" "p" "La" "中心线" "" )
(princ)
)
(defun C:yxx()
(command "change" (ssget) "" "p" "La" "虚线" "" )
(princ)
)
(defun C:ycc()
(command "change" (ssget) "" "p" "La" "尺寸" "" )
(princ)
)
快速切换图层
lisp
(defun C:zxx()
(setvar "clayer" "中心线")
(princ)
)
(defun C:xx()
(setvar "clayer" "虚线")
(princ)
)
捕捉切线命令
lisp
(defun C:LL()
(setvar "cmdecho" 0)
(princ "请捕捉切点:")
(command "LINE" "tan" pause "tan" pause "")
(princ)
)