AutoLISP切换开关toggle设计设置系统变量,DCL对话框代码如下。
dia6a:dialog {
label = "TOGGLE切换开关应用" ;
:boxed_column {
label = "开关设定" ;
:toggle {
key = "tg_attdia" ;
label = "ATTDIA属性对话框输入" ;
}
:toggle {
key = "tg_dispsilh" ;
label = "DISPSILH仅显示轮廓线" ;
}
:toggle {
key = "tg_textfill" ;
label = "TEXTFILL文字填充控制" ;
}
:toggle {
key = "tg_fillmode" ;
label = "FILLMODE对象填充模式" ;
}
}
:boxed_column {
label = "命令记录" ;
:toggle {
key = "tg_logfilemode" ;
label = "LOGFILMODE命令记录开关" ;
}
:edit_box {
edit_width = 30 ;
key = "logfilemode" ;
label = "命令记录文件" ;
}
}
spacer_1;
ok_cancel;
}
LSP文件代码如下。
(defun c:dia6a ()
(setvar "cmdecho" 0)
(dcl_dia6a)
(prin1)
)
(defun dcl_dia6a ()
(setq dcl_id (load_dialog "dia6a"))
(new_dialog "dia6a" dcl_id)
(set_tile "tg_attdia" (itoa (getvar "attdia")))
(set_tile "tg_dispsilh" (itoa (getvar "dispsilh")))
(set_tile "tg_textfill" (itoa (getvar "textfill")))
(set_tile "tg_fillmode" (itoa (getvar "textfill")))
(set_tile "tg_logfilemode" (itoa (getvar "logfilemode")))
(set_tile "logfilename" (getvar "logfilename"))
(action_tile "accept" "(ok_dia6a) (done_dialog 1)")
(action_tile "cancel" "(cancel_dia6a) (done_dialog 1)")
(setq dd (start_dialog))
)
(defun ok_dia6a ()
(setvar "attdia" (atoi (get_tile "tg_attdia")))
(setvar "dispsilh" (atoi (get_tile "tg_dispsilh")))
(setvar "textfill" (atoi (get_tile "tg_textfill")))
(setvar "fillmode" (atoi (get_tile "tg_fillmode")))
(setvar "logfilemode" (atoi (get_tile "tg_logfilemode")))
(setvar "logfilename" (get_tile "logfilename"))
)
(defun cancel_dia6a ()
(alert
"取消\n返回【-1】给(start_dialog)函数\n所以【dd】=【-1】"
)
)
代码完。