DCL界面卡着了
初学DCL,点按钮的时候不会跳转执行命令,然后卡在界面了,怎么操作?rect:dialog {
label = "过滤设置" ;
:column {
fixed_width = true ;
width = 100 ;
:boxed_row {
label = "过滤选项" ;
:toggle {
key = "type" ;
label = "对象类型" ;
value = "1" ;
}
:toggle {
key = "blockname" ;
label = "图块名" ;
value = "0" ;
}
:button {
key = "pickpt" ;
label = "选择对象" ;
}
}
spacer_1;
}
spacer_1;
ok_cancel;
}
;;过滤选择
(DEFUN C:AA()
;DCL面板参数设置
;(if (null blockname-key)(setq blockname-key "1"))
(defun defaults ()
;;第一次执行不加载DCL参数
(if (/ dcl_sb nil)
(progn
(alert "运行了")
(set_tile "type" (itoa type-key))
(set_tile "blockname" (itoa blockname-key))
) ;progn
);if
)
;根据按钮操作
(defun do_type ()
(princ "执行类型")
(setq type-key (atoi temp))
;(setq type-key (atoi (get_TILE "type")))
(princ type-key)
)
(defun do_blockname ()
(princ "执行块名")
(setq blockname-key (atoi temp))
;(setq blockname-key (atoi (get_TILE "blockname")))
(princ blockname-key)
)
(defun do_pickpt ()
(princ "执行对象选择")
(setq ss (ssget (list (if (= typess 1)
(cons 0 "LINE")
(cons 0 "~none")
)
(if (= layer 1)
(cons 8 "WINDOW")
(cons 8 "~none")
)
)
)
)
)
(defun do_save ()
(princ "执行确认")
;(list (get_TILE "type"))
;(setq type-key (atoi (get_TILE "type")))
;(setq blockname-key (atoi (get_TILE "blockname")))
(setq ss (ssget (list (if (= typess 1)
(cons 0 "LINE")
(cons 0 "~none")
)
(if (= layer 1)
(cons 8 "WINDOW")
(cons 8 "~none")
)
)
)
)
(done_dialog 1)
)
;;加载DCl程序
(SETQ DCL_ID (LOAD_DIALOG "F:/lsp/DCL/AA.DCL"));加载
(NEW_DIALOG "rect" DCL_ID);记录id dcl中:dialog前的内容
;设置默认参数
;(SET_TILE "type" type-key);设定值
;(SET_TILE "blockname" blockname-key);设定值
;(defaults)
;读取当前值
;(MODE_TILE "RECT_W" 0);状态修改
(ACTION_TILE "type" "(setq temp $value)(do_type)");获取面板更新后状态
(ACTION_TILE "blockname" "(setq temp $value)(do_blockname)")
(ACTION_TILE "pickpt" "(do_pickpt)(done_dialog)")
(ACTION_TILE "accept" "(do_save)");获取面板更新后状态
(START_DIALOG)(UNLOAD_DIALOG DCL_ID)
(princ qqq)
(princ)
)
本帖最后由 vitalgg 于 2022-12-21 08:41 编辑
请牢牢记住,DCL是模态对话框,在与对话框交互时,不能使用任何与对话框之外的交互.
如 :
1、ssget 不带"x“ 或 "P" 的的操作,ssget函数,根据 sel_mode 参数的不同,有的需要交互,有的不需要交互。
2、get*系列,如 getint getstring getreal getpoint ,getcorner 等
3、command 系列:如 comand ,command-s vl-cmds 等
如果需要从绘图区传递数据,需要done_dialog退出对话框,与绘图区交互,取数据,设变量,再重新 new_dialog
可以跳转了,但不知道如何返回界面。将获得到数据写回界面例如edit box中。我这DCL没载文本框
;;过滤选择
(DEFUN C:AA()
;DCL面板参数设置
;(if (null blockname-key)(setq blockname-key "1"))
(defun defaults ()
;;第一次执行不加载DCL参数
(if (/ dcl_sb nil)
(progn
(alert "运行了")
(set_tile "type" (itoa type-key))
(set_tile "blockname" (itoa blockname-key))
) ;progn
);if
)
;根据按钮操作
(defun do_type ()
(princ "执行类型")
(setq type-key (atoi temp))
;(setq type-key (atoi (get_TILE "type")))
(princ type-key)
)
(defun do_blockname ()
(princ "执行块名")
(setq blockname-key (atoi temp))
;(setq blockname-key (atoi (get_TILE "blockname")))
(princ blockname-key)
)
(defun do_pickpt ()
(princ "执行对象选择")
(setq ss (ssget (list (if (= typess 1)
(cons 0 "LINE")
(cons 0 "~none")
)
(if (= layer 1)
(cons 8 "WINDOW")
(cons 8 "~none")
)
)
)
)
)
(defun do_save ()
(princ "执行确认")
;(list (get_TILE "type"))
;(setq type-key (atoi (get_TILE "type")))
;(setq blockname-key (atoi (get_TILE "blockname")))
(setq ss (ssget (list (if (= typess 1)
(cons 0 "LINE")
(cons 0 "~none")
)
(if (= layer 1)
(cons 8 "WINDOW")
(cons 8 "~none")
)
)
)
)
)
;;加载DCl程序
(SETQ DCL_ID (LOAD_DIALOG "F:/lsp/DCL/AA.DCL"));加载
(NEW_DIALOG "rect" DCL_ID);记录id dcl中:dialog前的内容
;设置默认参数
;(SET_TILE "type" type-key);设定值
;(SET_TILE "blockname" blockname-key);设定值
;(defaults)
;读取当前值
;(MODE_TILE "RECT_W" 0);状态修改
(ACTION_TILE "type" "(setq temp $value)(do_type)");获取面板更新后状态
(ACTION_TILE "blockname" "(setq temp $value)(do_blockname)")
(ACTION_TILE "pickpt" "(done_dialog 2)")
(ACTION_TILE "accept" "(do_save)");获取面板更新后状态
(setq what_next (start_dialog))
(cond
((= 2 what_next)
(progn
(setq pt (getpoint "\n选择基点"))
(done_dialog 1)
)
)
)
(UNLOAD_DIALOG DCL_ID)
(princ qqq)
(princ)
) vitalgg 发表于 2022-12-21 07:34
请牢牢记住,DCL是模态对话框,在与对话框交互时,不能使用任何与对话框之外的交互.
如 :
1、ssget 不带 ...
感谢,明白了。:handshake
页:
[1]