试试这个,
确保将两个文件放在一起,并且位于ACAD支持搜索路径中。
只需键入演示。
演示。dcl
- /////////////////////////////////////////////////////////////////////////////////////////////
- DEMO : dialog {
- label = "Demo.lsp";
- : column {
- : boxed_column {
- label = "Select a function:";
- : popup_list {
- key = "FUNCT";
- width = 18.0;
- fixed_width = true;
- alignment = centered;
- }
- : spacer {
- height = 0;
- }
- }
- : button {
- label = "&Ok";
- key = "accept";
- width = 18;
- fixed_width = true;
- alignment = centered;
- is_default = true;
- }
- : button {
- label = "&Exit";
- key = "cancel";
- width = 18;
- fixed_width = true;
- alignment = centered;
- is_cancel = true;
- }
- }
- }
- /////////////////////////////////////////////////////////////////////////////////////////////
演示。lsp
- (defun C:DEMO (/ DCL_ID FUNCT FUNCT_LIST)
- (or F:UNCT (setq F:UNCT 0))
- (setq FUNCT_LIST (list "Demo 1" "Demo 2" "Demo 3"))
- (setq DCL_ID (load_dialog "DEMO.dcl"))
- (if (not (new_dialog "DEMO" DCL_ID))
- (exit))
- (start_list "FUNCT")(mapcar 'add_list FUNCT_LIST)(end_list)
- (if F:UNCT-DEF (set_tile "FUNCT" (itoa F:UNCT-DEF)))
- (action_tile "accept"
- (strcat
- "(progn (setq F:UNCT (atoi (get_tile "FUNCT")) F:UNCT-DEF F:UNCT)"
- "(done_dialog)(setq button T))"))
- (action_tile "cancel" "(done_dialog)(setq button nil)")
- (start_dialog)
- (unload_dialog DCL_ID)
- (setq FUNCT F:UNCT)
- (if button
- (cond
- ((= FUNCT 0)(ALERT "You selected Demo 1"))
- ((= FUNCT 1)(ALERT "You selected Demo 2"))
- ((= FUNCT 2)(ALERT "You selected Demo 3"))))
- (princ))
|