明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 48|回复: 1

下午还能用晚上用不了 了

[复制链接]
发表于 昨天 23:06 | 显示全部楼层 |阅读模式
(defun c:TOOLS (/ *error* dcl_id dcl_file dcl_content result)
  ;; 错误处理函数
  (defun *error* (msg)
    (if dcl_id (unload_dialog dcl_id))
    (if dcl_file (vl-file-delete dcl_file))
    (princ "\n* 工具箱已清理 *")
  )

  ;; 对话框定义
  (setq dcl_content
"tools : dialog {
  label = \"智能绘图工具集 V2.1\";
  spacer;

  : boxed_column {
    label = \"核心工具\";
    : row {
      : button { key = \"ac\";   label = \"智能绘弧\";   width = 15; fixed_width = true; }
      : button { key = \"JX\";  label = \"快速矩形\";  width = 15; fixed_width = true; }
    }
    : row {
      : button { key = \"zd\";  label = \"展点标注\";   width = 15; fixed_width = true; }
      : button { key = \"zb\";  label = \"坐标汇总\";   width = 15; fixed_width = true; }
    }
  }

  : boxed_column {
    label = \"专业工具\";
    : row {
      : button { key = \"hzq\"; label = \"挡土墙设计\"; width = 15; fixed_width = true; }
      : button { key = \"dmt\"; label = \"断面绘制\";   width = 15; fixed_width = true; }
    }
    : row {
      : button { key = \"dmj\"; label = \"土方计算\";   width = 15; fixed_width = true; }
      : button { key = \"mjb\"; label = \"面积统计\";   width = 15; fixed_width = true; }
    }
  }

  : boxed_column {
    label = \"实用工具\";
    : row {
      : button { key = \"hb\";  label = \"填充处理\";   width = 15; fixed_width = true; }
      : button { key = \"MPE\"; label = \"多段线合并\"; width = 15; fixed_width = true; }
    }
    : row {
      : button { key = \"ft\";  label = \"图纸分割\";   width = 15; fixed_width = true; }
      : button { key = \"gp\";  label = \"数据导出\";   width = 15; fixed_width = true; }
    }
  }

  ok_cancel;
}"
  )

  ;; 创建临时DCL文件
  (setq dcl_file (vl-filename-mktemp "TOOLS.dcl"))
  (if (not (setq f (open dcl_file "w")))
    (progn
      (alert "无法创建临时文件!\n请检查临时目录权限")
      (exit)
    )
  )
  (write-line dcl_content f)
  (close f)

  ;; 加载对话框
  (if (<= (setq dcl_id (load_dialog dcl_file)) 0)
    (progn
      (alert "对话框加载失败!\n可能原因:\n1. DCL语法错误\n2. 文件权限问题")
      (exit)
    )
  )

  ;; 初始化对话框
  (if (not (new_dialog "tools" dcl_id))
    (progn
      (alert "对话框初始化失败!")
      (exit)
    )
  )

  ;; 定义按钮动作
  (action_tile "ac"   "(done_dialog 1)")
  (action_tile "JX"  "(done_dialog 2)")
  (action_tile "zd"  "(done_dialog 3)")
  (action_tile "zb"  "(done_dialog 4)")
  (action_tile "hzq" "(done_dialog 5)")
  (action_tile "dmt" "(done_dialog 6)")
  (action_tile "dmj" "(done_dialog 7)")
  (action_tile "mjb" "(done_dialog 8)")
  (action_tile "hb"  "(done_dialog 9)")
  (action_tile "MPE" "(done_dialog 10)")
  (action_tile "ft"  "(done_dialog 11)")
  (action_tile "gp"  "(done_dialog 12)")

  ;; 显示对话框
  (setq result (start_dialog))
  (unload_dialog dcl_id)
  (vl-file-delete dcl_file)

  ;; 执行命令
  (cond
    ((= result 1)  (c:AC))
    ((= result 2)  (c:JX))
    ((= result 3)  (c:ZD))
    ((= result 4)  (c:ZB))
    ((= result 5)  (c:HZQ))
    ((= result 6)  (c:DMT))
    ((= result 7)  (c:DMJ))
    ((= result 8)  (c:MJB))
    ((= result 9)  (c:HB))
    ((= result 10) (c:MPE))
    ((= result 11) (c:FT))
    ((= result 12) (c:GP))
  )
  (princ)
)

;; 初始化提示
(princ "\n★ 智能工具箱已加载,输入命令 TOOLS 启动 ★")
(princ)

回复

使用道具 举报

发表于 昨天 23:22 | 显示全部楼层
本帖最后由 zhangrunze 于 2025-5-13 23:28 编辑

CAD2024 窗口正常弹出~还是小白,学习中。
是不是运行环境的问题?

什么都没有动,运行正常~

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-14 05:39 , Processed in 0.141238 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表