- (defun c:tt (/ dcl_file dcl_id make_dcl p0)
- (defun make_dcl (/ lst_str str file f)
- (setq lst_str
- '(
- "csyx:dialog
- {label = "测试一下";"
- ":row
- {
- :boxed_column
- {fixed_height = true; label = "模块1";
- :row
- {:column {spacer_0;}
- :column {:radio_button {key = "m1_1"; label = "新增";} :radio_button {key = "m1_2"; label = "利旧";} spacer_1; }
- }
- }
- :boxed_column
- {fixed_height = true; label = "模块2";
- :row
- {:column{spacer_0;}
- :column {:radio_button {key = "m2_1"; label = "新增";} :radio_button {key = "m2_2"; label = "利旧";} spacer_1; }
- }
- }
-
- :row{spacer_1;}
- }"
- ":spacer {}
- :row{
- spacer_1; spacer_1; :button {key = \accept\; is_default = true; fixed_width = true; label = "确定";}
- :button {key = "cancel"; is_cancel = true; fixed_width = true; label = "取消";} spacer_1; spacer_1;
- }
- :spacer {}
- }"
- )
- )
- (setq file (vl-filename-mktemp "DclTemp.dcl") )
- (setq f (open file "w") )
- (foreach str lst_str
- (princ "\n" f)
- (princ str f)
- )
- (close f)
- file
- )
- (if (= (setq dcl_id (load_dialog (setq dcl_file (make_dcl) ) ) ) 0) (progn (alert "\n无法显示对话框!") (exit) ) )
- (if dcl_file (vl-file-delete dcl_file) )
- (if (not (new_dialog "csyx" dcl_id) ) (progn (alert "\n无法显示对话框!") (exit) ) )
-
- (action_tile "m1_1" "(setq mk1 1)" )
- (action_tile "m1_2" "(setq mk1 2)" )
- (action_tile "m2_1" "(setq mk2 1)" )
- (action_tile "m2_2" "(setq mk2 2)" )
- (action_tile "accept" "(done_dialog 1)")
- (action_tile "cancel" "(done_dialog 0) (exit)")
- (start_dialog)
- (unload_dialog dcl_id)
- (setq p0 (getpoint "\n插入点: ") )
- (setq p1 (mapcar '+ p0 '(500 0 0) ) )
- (setq p2 (mapcar '+ p0 '(500 500 0) ) )
- (setq p3 (mapcar '+ p0 '(0 500 0) ) )
- (setq p4 (mapcar '+ p0 '(0 0 0) ) )
- (setq p5 (mapcar '+ p0 '(1500 0 0) ) )
- (setq p6 (mapcar '+ p0 '(1500 1500 0) ) )
- (setq p7 (mapcar '+ p0 '(0 1500 0) ) )
- (setq p8 (mapcar '+ p0 '(0 0 0) ) )
- (setq p9 (mapcar '+ p0 '(2500 00 0) ) )
- (setq p10 (mapcar '+ p0 '(2500 2500 0) ) )
- (setq p11 (mapcar '+ p0 '(0 2500 0) ) )
- (setq p12 (mapcar '+ p0 '(0 0 0) ) )
- (setq p13 (mapcar '+ p0 '(3500 0 0) ) )
- (setq p14 (mapcar '+ p0 '(3500 3500 0) ) )
- (setq p15 (mapcar '+ p0 '(0 3500 0) ) )
-
- (defun csyx1 () (command "pline" p0 p1 p2 p3 p0 "") )
-
- (defun csyx2 () (command "pline" p4 p5 p6 p7 p4 "") )
- (defun csyx3 () (command "pline" p8 p9 p10 p11 p8 "") )
-
- (defun csyx4 () (command "pline" p12 p13 p14 p15 p12 "") )
- (cond
- ( (= mk1 1) (csyx1) )
- ( (= mk1 2) (csyx2) )
- ( (= mk2 1) (csyx3) )
- ( (= mk2 2) (csyx4) )
- )
- (princ)
- )
以上代码想实现独立运行,搜索了一下好像需求加回调函数?或者是单选按钮没有选中时跳过执行下一组命令请教一下怎么写?
另外,这个默认选中的代码除了加value在面板上生效外,在命令执行时需要加什么?感谢感谢~
|