明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2533|回复: 3

[已解答] 自定义面板函数

[复制链接]
发表于 2013-9-2 21:57 | 显示全部楼层 |阅读模式
本帖最后由 958620832 于 2013-9-2 21:59 编辑

dcl文件内容:
xx:dialog {
    label = "自定义面板函数" ;
    :row {
        :boxed_row {
            label = "尺寸" ;
            :column {
                :button {
                    key = "x1" ;
                    label = "标注断开" ;
                }
                :button {
                    key = "x2" ;
                    label = "位置取齐" ;
                }
                :button {
                    key = "x3" ;
                    label = "位置取齐" ;
                }
                :button {
                    key = "x4" ;
                    label = "位置取齐" ;
                }
            }
            :column {
                :button {
                    key = "x5" ;
                    label = "延长线段" ;
                }
                :button {
                    key = "x6" ;
                    label = "延长线段" ;
                }
                :button {}
                :button {}
            }
        }
        :boxed_column {
            label = "文字" ;
            :button {}
            :button {}
            :button {}
            :button {}
        }
    }
    :row {
        :boxed_column {
            label = "修改" ;
            :button {}
            :button {}
            :button {}
            :button {}
        }
        :boxed_row {
            label = "备用" ;
            :column {
                :button {}
                :button {}
                :button {}
                :button {}
            }
            :column {
                :button {}
                :button {}
                :button {}
                :button {}
            }
        }
    }
    cancel_button;
}
lisp文件内容:
(defun c:xx ()
(if (< (setq id (load_dialog "E:\\我的文档\\USB\\自定面板函数2")) 0) (exit))
(if (not (new_dialog "xx" id))(exit))
(setq n 1)
(repeat 4
  (action_tile (strcat "x" (rtos n)) "(done_dialog n)")
  (setq n (+ n 1)))
(setq sdt (start_dialog))
(setq clist '((c:k1) (c:k2)(c:k3)(c:k4)(c:k5)(c:k6)))
(if (> sdt 0) (eval (nth (- sdt 1) clist)))
(unload_dialog)
(princ))
问题如下:
点击k1,k2,k3,k4按钮,为什么显示的都是(c:k5),而不是k1,k2,k3,k4呢?为什么?难道repeat函数在这里不能用?

发表于 2013-9-2 22:59 | 显示全部楼层
n 即是变量,在双引号里面肯定是错的,程序有问题。
发表于 2013-9-3 16:21 | 显示全部楼层
本帖最后由 zlg258369 于 2013-9-3 20:12 编辑

执行(done_dialog n)时已循环完,此时n已经等于5

(action_tile (strcat "x" (rtos n)) "(done_dialog   (atoi (substr $key 2)))")

评分

参与人数 1明经币 +1 收起 理由
958620832 + 1 很给力!

查看全部评分

发表于 2016-1-24 07:34 | 显示全部楼层
同步学习中^^^…………
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-6-2 10:25 , Processed in 0.136458 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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