CAD中LISP程序使用方法

上传人:宝路 文档编号:5506053 上传时间:2017-09-06 格式:DOC 页数:5 大小:92KB
返回 下载 相关 举报
CAD中LISP程序使用方法_第1页
第1页 / 共5页
CAD中LISP程序使用方法_第2页
第2页 / 共5页
CAD中LISP程序使用方法_第3页
第3页 / 共5页
CAD中LISP程序使用方法_第4页
第4页 / 共5页
CAD中LISP程序使用方法_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《CAD中LISP程序使用方法》由会员分享,可在线阅读,更多相关《CAD中LISP程序使用方法(5页珍藏版)》请在金锄头文库上搜索。

1、CAD 中 LISP 程序使用方法 2007-08-06 19:13:32| 分类: 学习园地 |字号 订阅 1. 对于提供附件下载的,把附件下载就可以了 2. 对于提供的源 LISP 代码,把代码拷贝、粘贴到一个文件,自己起个名或者若程序里面注释推荐了文件名,就用推荐的,然后保存成扩展名是 LSP 的文件即可了。 LISP 程序使用方法: 加载 LISP 1. 可以使用 APPLOAD 命令,然后去找到要加载的 LISP 文件,加载即可。 2. 可以自己从文件管理器把 LISP 文件拖动到 ACAD 的图形窗口,也可以加载 3. 在命令行后用,(load c:tempxxx.lsp)也可以加

2、载,路径名请输入实际的路径。 另:对于一个 LSP 程序,(defun 后面的既是命令或者函数,一般程序应该有提示,若没有,标志符 c:后面的单词是可以在 ACAD 下使用的命令,既可以在COMMAND:后面直接输入,即可执行。CAD 快速切换图层 LISP 代码(方法 2)给楼主发一个图层更改的 lisp 程序,按对应数字键就可以切换到相应的图层。很方便。001OBJ26t3SCETR。8BORDER如果这些不是你想要的图层,将 lisp 用笔记本打开,把里边的 OBJ,6t 等图层名改为你想要的就可以了。以后要切换图层时,按相应的数字键即可。(defun YH_chlayer (YH_la

3、yer / YH_S)(if (null (tblsearch LAYER YH_layer)(entmake (list(0 . LAYER)(100 . AcDbSymbolTableRecord)(100 . AcDbLayerTableRecord)(cons 2 YH_layer) ;图层名称(70 . 0) ;图层状态(62 . 7) ;图层颜色(6 . bylayer) ;图层线型)(setq YH_S (cadr (ssgetfirst)(if YH_S(command CHPROP YH_S la YH_layer c bylayer )(setvar clayer YH_l

4、ayer)(princ)(defun c:0 ()(YH_chlayer 0)(defun c:1 ()(YH_chlayer OBJ)(defun c:2 ()(YH_chlayer 6t)(defun c:3 ()(YH_chlayer SCETR)(defun c:4 ()(YH_chlayer HIDD)(defun c:5 ()(YH_chlayer DIM)(defun c:6 ()(YH_chlayer DASH)(defun c:7 ()(YH_chlayer TEXT)(defun c:8 ()(YH_chlayer BORDER)#Cad 到上面一行为址,保存为 lsp 格

5、式。LISP 小程序, 改变对象颜色;数字 1 (defun C:1 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为红色) (setq gp (ssget) (if (/= gp nil) (command .change gp p c 1 ) (princ nOK) (princ) );end defun C:1 ;数字 2 (defun C:2 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为黄色) (setq gp (ssget) (if (/= gp nil) (command .change gp p c 2

6、) (princ nOK) (princ) );end defun C:2 ;数字 3 (defun C:3 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为绿色) (setq gp (ssget) (if (/= gp nil) (command .change gp p c 3 ) (princ nOK) (princ) );end defun C:3 ;数字 4 (defun C:4 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为青色) (setq gp (ssget) (if (/= gp nil) (comma

7、nd .change gp p c 4 ) (princ nOK) (princ) );end defun C:4 ;数字 5 (defun C:5 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为蓝色) (setq gp (ssget) (if (/= gp nil) (command .change gp p c 5 ) (princ nOK) (princ) );end defun C:5 ;数字 6 (defun C:6 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为紫色) (setq gp (ssget) (i

8、f (/= gp nil) (command .change gp p c 6 ) (princ nOK) (princ) );end defun C:6;数字 7 (defun C:7 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为白色) (setq gp (ssget) (if (/= gp nil) (command .change gp p c 7 ) (princ nOK) (princ) );end defun C:7;数字 8 (defun C:8 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为深灰色) (setq gp (ssget) (if (/= gp nil) (command .change gp p c 8 ) (princ nOK) (princ) );end defun C:8;数字 9 (defun C:9 ( / gp) (setvar cmdecho 0) (princ n改变对象颜色为灰色) (setq gp (ssget) (if (/= gp nil) (command .change gp p c 9 ) (princ nOK) (princ) );end defun C:9

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号