- 积分
- 10012
- 明经币
- 个
- 注册时间
- 2021-12-8
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 dtucad 于 2022-5-8 10:44 编辑
【2022元旦福利】好玩又实用的菜单,密集恐惧症的福音,新手的知音--刀图菜单系统V1.0
厌倦了DCL的按钮吗?来试试不一样体验。
不需要学习DCL,0基础就能玩。
永久免费无限制,明经用户福利
(免币了这么久,2022.5.8开始收个币)
测试说明:
1、命令netload加载dll文件;
2、加载例子lisp文件;
3、输入tt或ttt命令。
例子中包含使用说明
问题:
如果DLL文件加载出错,可以尝试以下方法解决
1、dll文件右键,取得管理员权限
2、将dll文件放到CAD支持文件路径
3、如以上方法不能解决请加群咨询
- ;刀图圆形菜单-V1.0 2021.12.31 QQ群:894659298
- ;
- ;测试说明:
- ;1、命令netload加载dll文件;
- ;2、加载例子lisp文件;
- ;3、输入tt或ttt命令。
- ;
- ;使用说明:
- ;1、调用菜单函数:(DTU-CircleMenu "test1.ini" 500 4 8)
- ;参数1 配置文件名(字符串)
- ;参数2 圆形直径(整数,建议200以上,最大600)
- ;参数3 同心圆数量(大于等于2的整数)
- ;参数4 扇形数量(整数,建议10以内)
- ;
- ;2、ini配置文件格式举例:直线=line
- ;等号前"直线"为菜单显示名字
- ;等号后"line"为命令名字,命令可以是cad命令或lisp函数名
- ;3、原理:将等号后命令发送到cad并执行。
- ;调用刀图圆形菜单例子1
- (defun c:tt ()
- (DTU-CircleMenu "test1.ini" 300 3 6)
- (princ)
- )
- ;测试代码1
- (defun c:test1 ()
- (alert "刀图圆形菜单测试1")
- (princ "\n刀图圆形菜单测试1")
- (princ)
- )
- ;测试代码2
- (defun test2 ()
- (alert "刀图圆形菜单测试2")
- (princ "\n刀图圆形菜单测试2")
- (princ)
- )
- ;调用刀图圆形菜单例子2
- (defun c:ttt ()
- (DTU-CircleMenu "test2.ini" 400 4 8)
- (princ)
- )
本代码修改自:http://bbs.mjtd.com/thread-111059-1-1.html
- ;刀图矩形菜单-V1.0 2021.12.31 QQ群:894659298
- ;快速选择(命令:xx)--刀图矩形菜单实例
- ;
- ;测试说明:
- ;1、命令netload加载dll文件;
- ;2、加载例子lisp文件;
- ;3、输入tt或ttt命令。
- ;
- ;使用说明:
- ;1、调用菜单函数:(DTU-RectMenu "ksxz.ini" 650 200 3 4)
- ;参数1 配置文件名(字符串)
- ;参数2 矩形菜单宽度(整数)
- ;参数3 矩形菜单高度(整数)
- ;参数4 行数(整数)
- ;参数5 列数(整数)
- ;
- ;2、ini配置文件格式举例:直线=line
- ;等号前"直线"为菜单显示名字
- ;等号后"line"为命令名字,命令可以是cad命令或lisp函数名
- ;3、原理:将等号后命令发送到cad并执行。
- ;命令:
- ;x1选择同名图块
- ;x11选择同名图块+相同图层
- ;x111选择同名图块+相同图层+相同颜色
- ;x3选择相同文字 (支持天正文字、标高)
- ;x33选择相同文字+相同图层 (支持天正文字、标高、箭头、引出标注)
- ;x333选择相同文字+相同图层+相同颜色
- ;x4选择同类型图元 比如line、Pline、圆、块、文字、墙、窗等
- ;x44选择同类型图元+相同图层
- ;x444选择同类型图元+相同图层+相同颜色
- ;x2选择相同图层图元
- ;x22选择图层图元+相同颜色
- ;x5选择相同颜色图元
- ;在上述命令后加a(比如x1a)表示自动全图选择
- ;调用刀图圆形菜单
- (defun c:xx ()
- (DTU-RectMenu "ksxz.ini" 600 200 3 4)
- ;参数1为配置文件名(字符串),参数2为矩形菜单宽度(整数),参数3为高度(整数),参数4为行数(整数),参数5为列数(整数)
- (princ)
- )
- ;以下为主程序
- (defun c:x1 (/ ss n-list);选择图块
- (princ "\n选择源图块<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "INSERT")))))
- (setq ss (ssget '((0 . "INSERT"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (tukuai ss))
- (setq ss (ssget (list (cons 2 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x1a (/ ss n-list);选择图块-全图
- (princ "\n选择源图块<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "INSERT")))))
- (setq ss (ssget '((0 . "INSERT"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (tukuai ss))
- (setq ss (ssget "x" (list (cons 2 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x11 (/ ss n-list tuc-list);选择图块+图层
- (princ "\n选择源图块<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "INSERT")))))
- (setq ss (ssget '((0 . "INSERT"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (tukuai ss))
- (setq tuc-list (tuc ss))
- (setq ss (ssget (list (cons 2 n-list)(cons 8 tuc-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x11a (/ ss n-list tuc-list);选择图块+图层-全图
- (princ "\n选择源图块<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "INSERT")))))
- (setq ss (ssget '((0 . "INSERT"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (tukuai ss))
- (setq tuc-list (tuc ss))
- (setq ss (ssget "x" (list (cons 2 n-list)(cons 8 tuc-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x111 (/ ss n-list tuc-list yans-list);选择图块+图层+颜色
- (princ "\n选择源图块<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "INSERT")))))
- (setq ss (ssget '((0 . "INSERT"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (tukuai ss))
- (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget (list (cons 2 n-list)(cons 8 tuc-list))))
- )
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun c:x111a (/ ss n-list tuc-list yans-list);选择图块+图层+颜色-全图
- (princ "\n选择源图块<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "INSERT")))))
- (setq ss (ssget '((0 . "INSERT"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (tukuai ss))
- (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget "x" (list (cons 2 n-list)(cons 8 tuc-list))))
- )
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun c:x2 (/ ss n-list);选择图层
- (princ "\n选择源图层<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq n-list (tuc ss))
- (setq ss (ssget (list (cons 8 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x2a (/ ss n-list);选择图层-全图
- (princ "\n选择源图层<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq n-list (tuc ss))
- (setq ss (ssget "x" (list (cons 8 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x22 (/ ss tuc-list yans-list);图层+颜色
- (princ "\n选择源图层<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget (list (cons 8 tuc-list))))
- )
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun c:x22a (/ ss tuc-list yans-list);图层+颜色-全图
- (princ "\n选择源图层<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget "x" (list (cons 8 tuc-list))))
- )
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun c:x3 (/ ss n-list);选择文字
- (princ "\n选择源文字<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER")))))
- (setq ss (ssget '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (wenzi ss))
- (setq ss (ssget (list (cons 1 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x3a (/ ss n-list);选择文字-全图
- (princ "\n选择源文字<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER")))))
- (setq ss (ssget '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (wenzi ss))
- (setq ss (ssget "x" (list (cons 1 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x33 (/ ss n-list tuc-list);选择文字+图层
- (princ "\n选择源文字<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER")))))
- (setq ss (ssget '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (wenzi ss))
- (setq tuc-list (tuc ss))
- (setq ss (ssget (list (cons 1 n-list)(cons 8 tuc-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x33a (/ ss n-list tuc-list);选择文字+图层-全图
- (princ "\n选择源文字<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER")))))
- (setq ss (ssget '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (wenzi ss))
- (setq tuc-list (tuc ss))
- (setq ss (ssget "x" (list (cons 1 n-list)(cons 8 tuc-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x333 (/ ss n-list tuc-list yans-list);选择文字+图层+颜色
- (princ "\n选择源文字<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER")))))
- (setq ss (ssget '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (wenzi ss))
- (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget (list (cons 1 n-list)(cons 8 tuc-list))))
- )
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun c:x333a (/ ss n-list tuc-list yans-list);选择文字+图层+颜色-全图
- (princ "\n选择源文字<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p" '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER")))))
- (setq ss (ssget '((0 . "*TEXT,TCH_ELEVATION,TCH_ARROW,TCH_MULTILEADER"))))
- )
- (if ss
- (progn
- (if (and (setq n-list (wenzi ss))
- (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget "x" (list (cons 1 n-list)(cons 8 tuc-list))))
- )
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun c:x4 (/ ss n-list tuc-list);选择图元
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq n-list (tuyuan ss))
- ;(setq tuc-list (tuc ss))
- (setq ss (ssget (list (cons 0 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x44 (/ ss n-list tuc-list);选择图元+图层
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq n-list (tuyuan ss))
- (setq tuc-list (tuc ss))
- (setq ss (ssget (list (cons 0 n-list) (cons 8 tuc-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x4a (/ ss n-list tuc-list);选择图元-全图
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq n-list (tuyuan ss))
- ;(setq tuc-list (tuc ss))
- (setq ss (ssget "x" (list (cons 0 n-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x44a (/ ss n-list tuc-list);选择图元+图层-全图
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and (setq n-list (tuyuan ss))
- (setq tuc-list (tuc ss))
- (setq ss (ssget "x" (list (cons 0 n-list) (cons 8 tuc-list))))
- )
- (tjgs ss)
- )
- ))
- (princ)
- )
- (defun c:x444 ( / n-list ss tuc-list yans-list);选择图元+图层+颜色
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and
- (setq n-list (tuyuan ss))
- (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget (list (cons 0 n-list) (cons 8 tuc-list)))))
- (xzys ss yans-list)
- )
- )
- )
- (princ)
- )
- (defun c:x444a ( / n-list ss tuc-list yans-list);选择图元+图层+颜色-全图
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and
- (setq n-list (tuyuan ss))
- (setq tuc-list (tuc ss))
- (setq yans-list (yans ss))
- (setq ss (ssget "x" (list (cons 0 n-list) (cons 8 tuc-list)))))
- (xzys ss yans-list)
- )
- )
- )
- (princ)
- )
- (defun c:x5 ( / ss yans-list);选择颜色
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and
- (setq yans-list (yans ss))
- (setq ss (ssget)))
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun c:x5a ( / ss yans-list);选择颜色-全图
- (princ "\n选择源图元<可多选>:")
- (if (cadr (ssgetfirst))
- (progn (sssetfirst) (setq ss (ssget "p")))
- (setq ss (ssget))
- )
- (if ss
- (progn
- (if (and
- (setq yans-list (yans ss))
- (setq ss (ssget "x")))
- (xzys ss yans-list)
- )
- ))
- (princ)
- )
- (defun tjgs(ss);统计个数子程序
- (sssetfirst nil ss)
- (princ (strcat "\n共选中了" (itoa (sslength ss)) "个实体。"))
- (princ)
- )
- (defun tuc (ss / n i ent name name-list);选择图层子程序
- (setq n (sslength ss))
- (setq i (- n 1))
- (repeat n
- (setq ent (ssname ss i))
- (setq name (cdr (assoc 8 (entget ent))))
- (if (= name-list nil)(setq name-list name)(setq name-list (strcat name-list "," name)))
- (setq i (1- i))
- )
- name-list
- )
- (defun tukuai (ss / n i ent name name-list);选择图块子程序
- (setq n (sslength ss))
- (setq i (- n 1))
- (repeat n
- (setq ent (ssname ss i))
- (setq name (cdr (assoc 2 (entget ent))))
- (if (= name-list nil)(setq name-list name)(setq name-list (strcat name-list "," name)))
- (setq i (1- i))
- )
- name-list
- )
- (defun wenzi (ss / n i ent name name-list);选择文字子程序
- (setq n (sslength ss))
- (setq i (- n 1))
- (repeat n
- (setq ent (ssname ss i))
- (setq name (cdr (assoc 1 (entget ent))))
- (if (= name-list nil)(setq name-list name)(setq name-list (strcat name-list "," name)))
- (setq i (1- i))
- )
- name-list
- )
- (defun tuyuan (ss / n i ent name name-list);选择图元子程序
- (setq n (sslength ss))
- (setq i (- n 1))
- (repeat n
- (setq ent (ssname ss i))
- (setq name (cdr (assoc 0 (entget ent))))
- (if (= name-list nil)(setq name-list name)(setq name-list (strcat name-list "," name)))
- (setq i (1- i))
- )
- name-list
- )
- (defun yans (ss / ent entdata i n name name-list);选择颜色子程序
- (setq n (sslength ss))
- (setq i (- n 1))
- (repeat n
- (setq ent (ssname ss i))
- (setq entdata (entget ent))
- (if (assoc 62 entdata)
- (setq name (cdr (assoc 62 entdata)))
- ;(setq name 256) ;颜色随层
- (setq name (cdr (assoc 62 (entget (tblobjname "layer" (cdr (assoc 8 entdata)))))));取图层颜色
- )
- (setq name-list (cons name name-list))
- (setq i (1- i))
- )
- name-list
- )
- (defun xzys (ss yans-list / ent entdata ent-yanse i j m n ss1 yanse);循环判断选择颜色子程序
- (setq ss1 (ssadd))
- (setq m (length yans-list))
- (setq j (- m 1))
- (setq n (sslength ss))
- (setq i (- n 1))
- (repeat n
- (setq ent (ssname ss i))
- (setq entdata (entget ent))
- (if (assoc 62 entdata)
- (setq ent-yanse (cdr (assoc 62 entdata))) ;(setq ent-yanse 256) ;颜色随层
- (setq ent-yanse (cdr (assoc 62 (entget (tblobjname "layer"(cdr (assoc 8 entdata))))))) ;取图层颜色
- )
- (while (>= j 0)
- (setq yanse (nth j yans-list))
- (if (= yanse ent-yanse)
- (progn
- (setq ss1 (ssadd ent ss1))
- (setq j 0)
- )
- )
- (setq j (1- j))
- )
- (setq j (- m 1))
- (setq i (1- i))
- )
- (tjgs ss1)
- )
- (princ "\n刀图圆形菜单---快速选择 命令:xx")(princ)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
评分
-
查看全部评分
|