AutoLISP单选按钮RADIO_BUTTON设计插入图块,DCL对话框代码如下。
dia6b:dialog {
label = "RADIO_BUTTON单选按钮" ;
:text {
alignment = centered ;
label = "插入图块" ;
}
:row {
:boxed_radio_column {
label = "设计者" ;
:radio_button {
key = "rb11" ;
label = "唐僧" ;
}
:radio_button {
key = "rb12" ;
label = "悟空" ;
}
:radio_button {
key = "rb13" ;
label = "八戒" ;
}
:radio_button {
key = "rb14" ;
label = "沙僧" ;
}
}
:boxed_radio_column {
label = "比例" ;
:radio_button {
key = "rb21" ;
label = "1/1" ;
}
:radio_button {
key = "rb22" ;
label = "1/30" ;
}
:radio_button {
key = "rb23" ;
label = "1/50" ;
}
:radio_button {
key = "rb24" ;
label = "1/100" ;
}
:radio_button {
key = "rb25" ;
label = "1/200" ;
}
}
}
:edit_box {
alignment = centered ;
edit_limit = 8 ;
edit_width = 8 ;
fixed_width = true ;
key = "dwgnum" ;
label = "编号" ;
}
spacer_1;
:row {
alignment = centered ;
fixed_width = true ;
:button {
key = "ins_ok" ;
label = "插入图块" ;
width = 8 ;
}
:spacer {
width = 8 ;
}
cancel_button;
}
}
LSP文件代码如下。
(defun c:dia6b ()
(setvar "cmdecho" 0)
(setq blkname "dia6att")
(dcl_dia6b)
(prin1)
)
(defun dcl_dia6b ()
(setq dcl_id (load_dialog "dia6b"))
(new_dialog "dia6b" dcl_id)
(setq defkey1 "rb14"
defkey2 "rb21"
)
(set_tile defkey1 "1")
(set_tile defkey2 "1")
(setq name (get_attr defkey1 "label"))
(setq ssca (get_attr defkey2 "label"))
(action_tile "rb11" "(setq name (get_attr $key \"label\"))")
(action_tile "rb12" "(setq name (get_attr $key \"label\"))")
(action_tile "rb13" "(setq name (get_attr $key \"label\"))")
(action_tile "rb14" "(setq name (get_attr $key \"label\"))")
(action_tile "rb21" "(setq name (get_attr $key \"label\"))")
(action_tile "rb22" "(setq name (get_attr $key \"label\"))")
(action_tile "rb23" "(setq name (get_attr $key \"label\"))")
(action_tile "rb24" "(setq name (get_attr $key \"label\"))")
(action_tile "rb25" "(setq name (get_attr $key \"label\"))")
(action_tile "ins_ok" "(ok_dia6b) (done_dialog 1)")
(setq dd (start_dialog))
(if (= dd 1)
(progn
(setq inspt (getpoint "\n选取属性图块插入点:"))
(command "insert" blkname inspt 1 1 0 dwgnum name ssca)
)
)
)
(defun ok_dia6b ()
(setq dwgnum (get_tile "dwgnum"))
)
代码完。