277283904 发表于 2023-12-7 20:54:58

怎么将所有CAD的快捷键都用lisp重新设一遍呢?

怎么将所有CAD的快捷键都用lisp重新设一遍呢?

liunian0524 发表于 2023-12-8 13:04:47

;自用左手快捷键
(defun c:g1 () (princ"隐藏选择对象") (setvar "cmdecho" 0) (command"_HideObjects") (princ));隐藏对象
(defun c:g2 () (princ"隔离选择对象") (setvar "cmdecho" 0) (command"_IsolateObjects") (princ));隔离对象
(defun c:g3 () (setvar "cmdecho" 0)(command"_UnIsolateObjects") (princ));显示对象
(defun c:1c()(princ"直线相切于圆/圆弧")(setvar "cmdecho" 0) (command "line" "tan" pause "tan" pause "")(princ))
(defun c:2c()(princ"快速圆三相切")(setvar "cmdecho" 0)(command "circle" "3p" "tan" pause "tan" pause "tan" pause)(princ))
(defun c:a()(princ "圆弧")(command "arc")(princ));圆弧
(defun c:ar()(princ"经典阵列")(command "arrayclassic")(princ))
(defun c:arr()(princ"环形阵列")(setq a (getint "\n请输入项目总数:"))(command "-array" (ssget) "" "p" pause a "360" "y")(princ))
(defun c:ate nil(initdia)(command "attedit")(princ));编辑属性块
(defun c:att nil(initdia)(command "attdef")(princ));创建属性对象
(defun c:ati ()(command "attipedit")(princ));编辑属性
(defun c:b nil(initdia)(princ "创建块") (command "block")(princ));创建块
(defun c:bo()(princ"边界创建")(command "-boundary")(princ))
(defun c:br()(princ"打断于点")(while(and (setq ent(car (entsel))) (setq pt(getpoint "\n指定一个打断点: ")))(command "._break" ent "_non" pt "_non" pt))(princ))
;(defun c:br()(princ"打断于点")(command "_breakatpoint")(princ))
(defun c:c(/ ss)(princ"实体复制")(setq ss (ssget))(command "copy" ss "" "m" )(princ))
(defun c:cb()(princ"复制嵌套对象,需要et支持")(command "ncopy")(princ))
(defun c:cc()(princ"圆")(command "circle")(princ))
(defun c:ccc ()(setq en (ssget))(if (= en nil)(setq en (ssget "p")))(command "copy" EN "" "m")(princ));上一次选择集复制
(defun c:cd()(princ"倒角")(command "chamfer")(princ))
(defun c:cm()(command "centermark")(princ));圆弧/圆心标记,15版本后才有
(defun c:cl()(command "centerline")(princ));角平分线;15版本后才有
(defun c:d ()(command "ddim")(princ));标注样式
(defun c:dli()(command "dimlinear")(princ));线性标注
(defun c:dal()(command "dimaligned")(princ));对齐标注
(defun c:do()(command "donut")(princ));圆环
(defun c:daa()(princ"连续标注")(command "dimcontinue")(princ))
(defun c:dc()(princ"半径标注")(command "dimradius" pause "")(princ))
(defun c:dy()(princ"圆心标注")(command "dimcenter")(princ))
(defun c:dd()(princ"角度标注")(command "dimangular" )(princ))
(defun c:dda()(princ"解除标注关联")(command "dimdisassociate")(princ))
(defun c:de()(princ"弧长标注")(command "dimarc")(princ))
(defun c:des()(princ"删除约束")(command "delconstraint")(princ))
(defun c:div()(princ"定数等分")(while(setq a (getint "\n请输入等分数目:"))(setq ss (ssget":s"))(command "divide" ss a))(princ))
(defun c:dsc()(princ"全局标注比例")(command "dimscale")(princ))
(defun c:dz()(princ"直径标注")(command "dimdiameter" pause "")(princ))
(defun c:pt()(command "ptype")(princ));点样式设置
(defun c:ed()(command "textedit")(princ));文字编辑
(defun c:ex()(command "extend")(princ));延伸
(defun c:ec()(princ"椭圆")(command "ellipse""c")(princ))
(defun c:e()(princ"实体删除")(command "erase")(princ))
(defun c:es ()(princ"\n删除所选文字和标注(不能在图块中)")(while (setq ss (ssget '((0 . "*mtext,text,leader,dimension,ARC_DIMENSION")))) (command ".erase" ss ""))(princ))
(defun c:ez ()(princ"\n删除所选标注(不能在图块中)")(while (setq ss (ssget '((0 . "leader,dimension,ARC_DIMENSION")))) (command ".erase" ss ""))(princ))
(defun c:et ()(princ"\n删除所选文字(不能在图块中)")(while (setq ss (ssget '((0 . "*mtext,text")))) (command ".erase" ss ""))(princ))
(defun c:eh ()(princ"\n删除所选填充(不能在图块中)")(while (setq ss (ssget '((0 . "hatch")))) (command ".erase" ss ""))(princ))
(defun c:eb()(princ"\n删除所选图块")(while (setq ss (ssget '((0 . "insert")))) (command ".erase" ss ""))(princ))
(defun c:er()(princ "\n选择要保留对象:")(setq SS (ssget) ss1 (ssget "X" ))(command "erase" ss1 "r" ss"" zoom _e)(princ))
(defun c:ef()(princ"\n删除所选构造线")(while (setq ss (ssget '((0 . "xline")))) (command ".erase" ss ""))(princ))
(defun c:exf nil(initdia) (command "export")(princ));输出数据
(defun c:fl()(command "_flatshot")(princ));平面摄影
(defun c:f()(princ"直线")(command "line" pause pause "")(princ))
(defun c:fa nil(initdia)(princ"图层特性管理器") (command "layer")(princ))
(defun c:fe()(princ"引线标注")(command "_qleader" pause pausepause )(princ))
(defun c:fd nil(initdia)(princ"查找与替换") (command "find")(princ))
(defun c:ff()(princ"圆角")(command "fillet")(princ))
(defun c:g ()(command "group" "c")(princ));建立组
(defun c:gx()(princ"分解组")(setvar 'cmdecho 0) (command "ungroup")(princ))
(defun c:gg()(princ"编辑组")(command "groupedit")(princ))
(defun c:h nil(initdia)(command "hatch")(princ));填充
(defun c:hb()(command "hatchtoback")(princ));填充后置
(defun c:he nil(initdia)(command "hatchedit")(princ));编辑填充
(defun c:i nil(initdia)(princ"经典插入块")(command "_classicinsert")(princ))
(defun c:io ()(princ"插入对象")(command "insertobj")(princ))
(defun c:ls()(command "list")(princ));查询对象
(defun c:lsc()(command "ltscale")(princ));线型比例因子
(defun c:lt nil(initdia) (command "linetype")(princ));线型管理器
(defun c:lw nil(initdia) (command "lweight")(princ));线宽设置
;(defun c:mj()(startapp "c:\\program files\\internet explorer\\iexplore.exe" "http://bbs.mjtd.com/" )(princ ))
(defun c:mj()(startapp "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe" "http://bbs.mjtd.com/" )(princ ))
(defun c:ml()(command "mline")(princ));多线
(defun c:ms()(command "mspace")(princ "布局空间转换到模型空间")(princ));布局空间转换到模型空间
(defun c:ps()(command "pspace")(princ "模型空间转换到布局空间")(princ));模型空间转换到布局空间
(defun c:mchs()(command "chspace")(princ "模型与布局对象切换")(princ));模型与布局对象切换
(defun c:mv()(command "mview")(princ));布局空间使用,创建视口
(defun c:mon()(command"mview""l""on")(princ "锁住视口")(princ));锁住视口
(defun c:moff()(command"mview""l""off")(princ "解锁视口")(princ));解锁视口
(defun c:pe()(command "pedit")(princ));编辑多段线
(defun c:po()(command "point")(princ));点
(defun c:pol()(command "polygon")(princ));多边形
(defun c:pu()(command "_.purge" "a" "" "n")(princ));pu清理
(defun c:pgp()(princ"自定义编辑程序参数")(setvar "cmdecho" 0)(setvar "re-init" 16)(vl-cmdf "_ai_editcustfile" )(vl-cmdf (findfile "acad.pgp" ))(setvar "cmdecho" 1)(princ))
(defun c:qq nil(initdia)(princ"删除重复对象")(command "overkill")(princ));删除重复对象,12版本后才有
(defun c:qc()(command "_quickcalc")(princ));计算器
(defun c:re()(command "regen")(princ));重生成
(defun c:rec()(command "rectang")(princ));矩形
(defun c:reg()(command "region")(princ));创建面域
(defun c:ren nil(initdia)(command "rename")(princ));重命名
(defun c:r()(princ"实体偏移")(command "offset")(princ))
(defun c:rea()(princ"重新初始化")(command "reinit")(princ))
(defun c:rr()(princ"实体旋转")(command "rotate" )(princ));旋转
(defun c:rs nil(initdia)(princ"草图设置")(command "_+dsettings" "2")(princ));草图设置(0-7)
(defun c:rt()(princ"选项设置")(command "_+options""1")(princ));打开选项(0-9)
(defun c:rtr()(princ"旋转文字方向,需要et支持")(c:torient))
(defun c:set ()(setvar "cmdecho" 0)(while(setq ss (ssget":s"))(command "setbylayer" ss "" "y" "y"))(princ));随层
(defun c:lf()(princ"动态拉伸直线或圆弧")(setvar "cmdecho" 0)(command "lengthen" "dy") (princ))
(defun c:sf()(princ"动态拉伸直线或圆弧")(setvar "cmdecho" 0)(command "lengthen" "dy") (princ))
(defun c:stf()(princ"样条曲线")(command "spline")(princ))
(defun c:sv nil(initdia)(princ"文件另存为")(command "save")(princ))
(defun c:sy()(princ"系统变量监视")(command "sysvarmonitor")(princ))
(defun c:stf()(command "spline")(princ));样条曲线
(defun c:s()(command "stretch")(princ));拉伸
(defun c:sc()(command "scale")(princ));比例缩放
(defun c:st nil(initdia)(command "style")(princ));文字样式
(defun c:t nil(initdia)(command "mtext")(princ));多行文字
(defun c:ta()(command "textalign")(princ));
(defun c:tf()(princ"多段线")(command "pline")(princ))
(defun c:to nil(initdia)(command "toolbar")(princ));自定义用户界面
(defun c:tr nil(initdia)(command "trim")(princ));修剪
(defun c:v()(princ"实体移动")(command "move")(princ))
(defun c:va()(princ"格式刷")(command "matchprop")(princ))
(defun c:vd nil(initdia)(princ"加载/卸载自定义设置")(command "menuload")(princ))
(defun c:ve()(setq ss (ssget":s"))(setq a (getint "\n请输入等分长度:"))(command "measure" ss a)(princ))
(defun c:vb()(princ"visual lisp编辑器")(c:vlide)(princ))
(defun c:vbb()(princ "设置visual lisp编辑器使用环境,需要在cad2020以后版本中才能使用")(setvar "lispsys" 0)(princ))
(defun c:vv()(princ"实体镜像")(command "mirror")(princ));镜像
(defun c:vw()(princ"视图管理器")(command "view")(princ))
(defun c:vf()(setvar "cmdecho" 0)(princ"三维视图-前视图")(command "view" "front")(princ))
(defun c:vt()(setvar "cmdecho" 0)(princ"三维视图-顶视图")(command "view" "top")(princ))
(defun c:vr()(setvar "cmdecho" 0)(princ"三维视图-右视图")(command "view" "right")(princ))
(defun c:vx()(setvar "cmdecho" 0)(princ"三维视图-西南轴侧图")(command "view" "swiso")(princ))
(defun c:wt nil(initdia) (command "wipeout")(princ));区域覆盖
(defun c:xc()(princ"裁剪块")(setq ss (ssget '((0 . "insert")))) (command "xclip" ss "" "n" "r")(setq ss nil) (princ))
(defun c:xf()(princ"构造线")(command "xline")(princ));构造线
(defun c:xh ()(princ"水平构造线")(command"xline""h" pause"")(princ))
(defun c:xs ()(princ"垂直构造线")(command"xline""v" pause"")(princ));
(defun c:w nil(initdia) (command "wblock")(princ));写块
(defun c:x ()(if (setq ss (ssget))(progn(setvar "qaflags" 1)(command ".explode" ss "")(setvar "qaflags" 0)))(princ));分解所选对象
(defun c:xa nil(initdia) (command "xattach")(princ));选择参照文件
(defun c:xb nil(initdia) (command "xbind")(princ));外部参照绑定
(defun c:xr nil(initdia) (command "xref")(princ));文件参照
(defun c:z()(command "zoom")(princ));缩放
(defun c:ze()(princ"范围缩放")(command "zoom""e")(princ))
(defun c:zw()(princ"窗口缩放")(command "zoom""w")(princ))

你有种再说一遍 发表于 2023-12-7 21:38:31

动态编译,但是lisp覆盖了某些命令可能和直接调用不一样,因此不建议你这样做,既然不喜欢其他插件命令,为什么要装它的,只喜欢人家插件某个命令的话建议自己写.

277283904 发表于 2023-12-8 08:32:36

你有种再说一遍 发表于 2023-12-7 21:38
动态编译,但是lisp覆盖了某些命令可能和直接调用不一样,因此不建议你这样做,既然不喜欢其他插件命令,为什么 ...

想用lisp替换CAD自带的快捷键命令

x_s_s_1 发表于 2023-12-8 08:38:56

277283904 发表于 2023-12-8 08:32
想用lisp替换CAD自带的快捷键命令

直接改PGP即可

277283904 发表于 2023-12-8 08:56:14

x_s_s_1 发表于 2023-12-8 08:38
直接改PGP即可

一个命令里面又有很多子命令,例如命令A有子命令A1A2A3A4,我想直达到A2的子命令

277283904 发表于 2023-12-8 09:30:47

但是这一系列的变量在那里查找呢

夏生生 发表于 2023-12-8 11:47:54

前言不搭后语啊,才开始学习autocad?“想用lisp替换CAD自带的快捷键命令”,CAD自带的快捷键就在PGP中修改,“一个命令里面又有很多子命令,例如命令A有子命令A1A2A3A4,我想直达到A2的子命令”这个就涉及到自定义了。

277283904 发表于 2023-12-8 13:42:55

liunian0524 发表于 2023-12-8 13:04
;自用左手快捷键
(defun c:g1 () (princ"隐藏选择对象") (setvar "cmdecho" 0) (command"_HideObjects") ( ...

谢谢!还有吗,这些在那里可以找的到,坛里有吗{:1_1:}

liunian0524 发表于 2023-12-8 16:01:17

277283904 发表于 2023-12-8 13:42
谢谢!还有吗,这些在那里可以找的到,坛里有吗

举一反三啊,在PPG里面可以看到原始命令全称
页: [1] 2
查看完整版本: 怎么将所有CAD的快捷键都用lisp重新设一遍呢?