明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2477|回复: 6

求助飞哥,dcl下拉框怎么显示图层列表啊?

[复制链接]
发表于 2005-6-28 09:53:00 | 显示全部楼层 |阅读模式
怎么把下拉列表改成当前图层列表啊?书上怎么提都没提到 dia7c.dcl dia7c:dialog{
label="下拉选图层"; :row{fixed_width=true;alignment=centered;
:edit_box{label="当前:";key="old1";edit_width=10;}
:popup_list{key="new1";edit_width=10;}
} spacer_1;
ok_cancel;
}
(defun c:kk()
(setvar "cmdecho" 0) (setq list '("5" "10" "20" "30" "40" "50"))
(dcl_dia7c)
(prin1)
) (defun dcl_dia7c()
(setq dcl_id (load_dialog "dia7c"))
(new_dialog "dia7c" dcl_id)
(show_list "new1" list)
(set_tile "old1" "10")
(action_tile "new1" "(sub_new1 $value)") (action_tile "accept" "(ok_dia7c)(done_dialog 1)")
(setq dd(start_dialog)) .......................................... ......................................... ....................................... (defun show_list(key newlist)
(start_list key)
(mapcar 'add_list newlist)
(end_list)
) (defun sub_new1(vvs)
(set_tile "old1" (nth (atoi vvs) list))
) (defun ok_dia7c() (setq old1 (get_tile "old1")) )

本帖子中包含更多资源

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

x
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2005-6-28 11:08:00 | 显示全部楼层
我加上一个提出层的涵数就OK了. 通过测试. 但你代码不全, 不懂你在搞什么科研啊. (defun Get-Laylist-BDY (/ DOC LAY-L LAYS)
(setq doc (vla-get-activedocument (vlax-get-Acad-Object)))
(setq lays (vla-get-layers doc))
(vlax-for item lays(SETQ LAY-L(APPEND LAY-L (LIST (vla-get-Name item)))))
)
(defun c:kk()
(setvar "cmdecho" 0)
(dcl_dia7c)
(prin1)
) (defun dcl_dia7c()
(setq dcl_id (load_dialog "D:\\TEST\\C1.DCL"))
(new_dialog "dia7c" dcl_id)
(show_list "new1" (Get-Laylist-BDY))
(set_tile "old1" "10")
(action_tile "new1" "(sub_new1 $value)") (action_tile "accept" "(ok_dia7c)(done_dialog 1)")
(setq dd(start_dialog))) (defun show_list(key newlist)
(start_list key)
(mapcar 'add_list newlist)
(end_list)
) (defun sub_new1(vvs)
(set_tile "old1" (nth (atoi vvs) list))
) (defun ok_dia7c() (setq old1 (get_tile "old1")) )
 楼主| 发表于 2005-6-28 13:20:00 | 显示全部楼层
谢谢楼上,果然出来的,不过我还有个地方不明白



子程序(defun sub_new1(vvs)                 (set_tile "old1" (nth (atoi vvs) list)))


改成了(defun sub_new1(vvs)                 (set_tile "old1" (nth (atoi vvs) (Get-Laylist-BDY))))


不知道是不是这样改的,程序到可以执行正常了


然后我去掉了赋初值(set_tile "old1" "10")


在最后加上        (if (= dd 1) (set_tile "old1" old1))


运行时,选了一下下拉列表里的(比如图层1),点确定,然后再次对话框,发现“当前:”里还是空白的,应该也显示“图层1”才对啊
 楼主| 发表于 2005-6-28 14:50:00 | 显示全部楼层
不知道我说清楚没有,就是改成了这样,但是在下拉列表里选了(比如图层1)之后,点确定,再次打开对话框,“当前”里面还是空的,最后一句没起作用: (if (= dd 1) (set_tile "old1" old1))
应该也显示图层1才对啊 (vl-load-com)
(defun Get-Laylist-BDY (/ DOC LAY-L LAYS)
(setq doc (vla-get-activedocument (vlax-get-Acad-Object)))
(setq lays (vla-get-layers doc))
(vlax-for item lays(SETQ LAY-L(APPEND LAY-L (LIST (vla-get-Name item)))))
)
(defun c:kk()
(setvar "cmdecho" 0)
(dcl_dia7c)
(prin1)
) (defun dcl_dia7c()
(setq dcl_id (load_dialog "dia7c.dcl"))
(new_dialog "dia7c" dcl_id)
(show_list "new1" (Get-Laylist-BDY))
(action_tile "new1" "(sub_new1 $value)") (action_tile "accept" "(ok_dia7c)(done_dialog 1)")
(setq dd(start_dialog))) (defun show_list(key newlist)
(start_list key)
(mapcar 'add_list newlist)
(end_list)
) (defun sub_new1(vvs)
(set_tile "old1" (nth (atoi vvs) (Get-Laylist-BDY)))
) (defun ok_dia7c() (setq old1 (get_tile "old1")) ) (if (= dd 1) (set_tile "old1" old1))
发表于 2005-6-28 14:55:00 | 显示全部楼层
不错. 蛮聪明的!
 楼主| 发表于 2005-6-28 14:58:00 | 显示全部楼层
可是执行不行啊,第一次比如输了“图层1”,第2次打开还是空的

本帖子中包含更多资源

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

x
 楼主| 发表于 2005-6-28 15:25:00 | 显示全部楼层
本帖最后由 作者 于 2005-6-28 15:49:08 编辑

哦,解决了,在中间加个if判断一下就可以了,想了半天
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-17 16:41 , Processed in 0.210311 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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