Help with Lisp

Status
Not open for further replies.

Donald Varino

Usenet Archive
Joined
Jan 21, 2001
Messages
26
Reaction score
0
I am using Autocad R14 and 2002 and I need this to be able to initiate the dialog (which it does) and the user selects what selections he/she chooses and they will automatically be there selected the next time they go into the dialog again. Also the select all and clear all functions do not work at all. Can anyone please enlighten me on the cause. Any help would be greatfull.... See code below

Don

;;;******LISP FILE**************
(defun c:qq (/ dcl_id status word-list sysvar-list var-list) (setq dcl_id (load_dialog "lblspc.dcl")) (if (not (new_dialog "lblspc" dcl_id)) (exit)
)

(action_tile "sel_all" "(set_tiles T)")
(action_tile "clr_all" "(set_tiles nil)")
(action_tile "spid" "(chk_all_tiles)")
(action_tile "spname" "(chk_all_tiles)")
(action_tile "spstatow" "(chk_all_tiles)")
(action_tile "spstatoc" "(chk_all_tiles)")
(action_tile "spcost" "(chk_all_tiles)")
(action_tile "area" "(chk_all_tiles)")
(action_tile "leaseid" "(chk_all_tiles)")
(action_tile "sporg" "(chk_all_tiles)")
(action_tile "spact" "(chk_all_tiles)")
(action_tile "spbill" "(chk_all_tiles)")
(action_tile "spstd" "(chk_all_tiles)")
(action_tile "spcatact" "(chk_all_tiles)")
(action_tile "sptypact" "(chk_all_tiles)")
(action_tile "spcatidl" "(chk_all_tiles)")
(action_tile "sploc" "(chk_all_tiles)")
(action_tile "lbblg" "(chk_all_tiles)")
(action_tile "lb4788" "(chk_all_tiles)")
(action_tile "lb4789" "(chk_all_tiles)")
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(action_tile "help" "(about)")

(action_tile
"accept"
(strcat
"(getabcode)"
"(done_dialog 0)"
)
)

(start_dialog)
(unload_dialog dcl_id)
(princ)
)

(defun getabcode
(setq answer (get_tile "code"))
(done_dialog 0)
)

(defun about (/ exitcode)
this
routine
runs
the
about
the
author
message
(if (not (new_dialog "about" dcl_id))
(exit)
)
(setq exitcode -1)
(while (< exitcode 0)
(about_msg)
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq exitcode (start_dialog))
) ;end while
)
(defun about_msg (/ temp)
(setq temp (list
"This routine was written by:"
" "
" "
" "
" "
" "
" "
" All Right Reserved.."
" "
)
)
(start_list "aboutbox" 3)
(mapcar 'add_list temp)
(end_list)
)

(defun chk_all_tiles
(if (and
(= (get_tile "spid") "1")
(= (get_tile "spname") "1")
(= (get_tile "spstatow") "1")
(= (get_tile "spstatoc") "1")
(= (get_tile "spcost") "1")
(= (get_tile "area") "1")
(= (get_tile "leaseid") "1")
(= (get_tile "sporg") "1")
(= (get_tile "spact") "1")
(= (get_tile "spbill") "1")
(= (get_tile "spstd") "1")
(= (get_tile "spcatact") "1")
(= (get_tile "sptypact") "1")
(= (get_tile "spcatidl") "1")
(= (get_tile "sploc") "1")
(= (get_tile "lbbldg") "1")
)
(= (get_tile "lb4788") "1")
)
(= (get_tile "lb4789") "1")
)
(progn
(mode_tile "sel_all" 1)
(mode_tile "clr_all" 0)
) ;end progn
(progn
(mode_tile "sel_all" 0)
(mode_tile "clr_all" 0)
) ;end progn

(if (and
(= (get_tile "spid") "0")
(= (get_tile "spname") "0")
(= (get_tile "spstatow") "0")
(= (get_tile "spstatoc") "0")
(= (get_tile "spcost") "0")
(= (get_tile "area") "0")
(= (get_tile "leaseid") "0")
(= (get_tile "sporg") "0")
(= (get_tile "spact") "0")
(= (get_tile "spbill") "0")
(= (get_tile "spstd") "0")
(= (get_tile "spcatact") "0")
(= (get_tile "sptypact") "0")
(= (get_tile "spcatidl") "0")
(= (get_tile "sploc") "0")
(= (get_tile "lbbldg") "0")
)
(= (get_tile "lb4788") "0")
)
(= (get_tile "lb4789") "0")
(progn
(mode_tile "sel_all" 0)
(mode_tile "clr_all" 1)
) ;end progn

(defun set_tiles (all)
(if all
(progn
(set_tile "spid" "1")
(set_tile "spname" "1")
(set_tile "spstatow" "1")
(set_tile "spstatoc" "1")
(set_tile "spcost" "1")
(set_tile "area" "1")
(set_tile "leaseid" "1")
(set_tile "sporg" "1")
(set_tile "spact" "1")
(set_tile "spbill" "1")
(set_tile "spstd" "1")
(set_tile "spcatact" "1")
(set_tile "sptypact" "1")
(set_tile "spcatidl" "1")
(set_tile "sploc" "1")
(set_tile "lbbldg" "1")
(set_tile "lb4788" "1")
(set_tile "lb4789" "1")
(mode_tile "sel_all" 1)
(mode_tile "clr_all" 0)
) ;end progn
(progn
(set_tile "spid" "0")
(set_tile "spname" "0")
(set_tile "spstatow" "0")
(set_tile "spstatoc" "0")
(set_tile "spcost" "0")
(set_tile "area" "0")
(set_tile "leaseid" "0")
(set_tile "sporg" "0")
(set_tile "spact" "0")
(set_tile "spbill" "0")
(set_tile "spstd" "0")
(set_tile "spcatact" "0")
(set_tile "sptypact" "0")
(set_tile "spcatidl" "0")
(set_tile "sploc" "0")
(set_tile "lbbldg" "0")
(set_tile "lb4788" "0")
(set_tile "lb4789" "0")
(mode_tile "sel_all" 0)
(mode_tile "clr_all" 1)
) ;end progn
) ;end if all
)

(defun setup_dialog (all / index x y)
(if all
(progn
(set_tile "spid" "1")
(set_tile "spname" "1")
(set_tile "spstatow" "1")
(set_tile "spstatoc" "1")
(set_tile "spcost" "1")
(set_tile "area" "1")
(set_tile "leaseid" "1")
(set_tile "sporg" "1")
(set_tile "spact" "1")
(set_tile "spbill" "1")
(set_tile "spstd" "1")
(set_tile "spcatact" "1")
(set_tile "sptypact" "1")
(set_tile "spcatidl" "1")
(set_tile "sploc" "1")
(set_tile "lbbldg" "1")
(set_tile "lb4788" "1")
(set_tile "lb4789" "1")
(mode_tile "sel_all" 1)
) ;end progn
) ;end if
(princ)
)

;;;******DCL FILE**************
dcl_settings : default_dcl_settings { audit_level = 3 ; } lblspc : dialog { label = "Generate Space Labels" ; spacer ; : row { : boxed_column { label = "Space Fields" ; : row { : column { : toggle { key = "SPID" ; label = "Space Id" ; mnemonic = "I" ; } : toggle { key = "SPNAME" ; label = "Space Name" ; mnemonic = "N" ; } : toggle { key = "SPSTATOW" ; label = "Own. Status" ; mnemonic = "w" ; } : toggle { key = "SPSTATOC" ; label = "Occ. Status" ; mnemonic = "c" ; } : toggle { key = "SPCOST" ; label = "Cost" ; mnemonic = "C" ; } : toggle { key = "AREA" ; label = "Area (SqFt)" ; mnemonic = "A" ; } : toggle { key = "LEASEID" ; label = "Lease" ; mnemonic = "L" ; } : toggle { key = "SPORG" ; label = "Organization" ; mnemonic = "O" ; } } : column { : toggle { key = "SPACT" ; label = "Activity" ; mnemonic = "t" ; } : toggle { key = "SPBILL" ; label = "Billing" ; mnemonic = "B" ; } : toggle { key = "SPSTD" ; label = "Space Std." ; mnemonic = "S" ; } : toggle { key = "SPCATACT" ; label = "Space Cat." ; mnemonic = "C" ; } : toggle { key = "SPTYPACT" ; label = "Space Type" ; mnemonic = "T" ; } : toggle { key = "SPCATIDL" ; label = "Ideal Use" ; mnemonic = "U" ; } : toggle { key = "SPLOC" ; label = "Location Grp." ; mnemonic = "G" ; } : spacer { height = 1 ; fixed_height = true ; } } } spacer_1 ; : row { : button { key = "SEL_ALL" ; label = "Select All" ; mnemonic = "S" ; } : button { key = "CLR_ALL" ; label = "Clear All" ; mnemonic = "C" ; } } } : column { : boxed_column { label = "Enter AB Code below"; width = 30; //height = 1; : edit_box { key = "code"; label = "AB Code to Query on"; } } : row { : toggle { key = "LBBLDG" ; label = "BLDG" ; mnemonic = "T" ; } : toggle { key = "LB4788" ; label = "4788" ; mnemonic = "C" ; } : toggle { key = "LB4789" ; label = "4789" ; mnemonic = "Z" ; } } } } spacer ; ok_cancel_help ; }

//Help section
about : dialog {
label = "About the Author";
: list_box {
key = "aboutbox";
width = 60;
}
ok_only;
}
 
o gawn no DCL...might i suggest you use VBA for this??

Jaime

"Donald Varino" wrote:

I am using Autocad R14 and 2002 and I need this to be able to initiate the dialog (which it does) and the user selects what selections he/she chooses and they will automatically be there selected the next time they go into
the
dialog again. Also the select all and clear all functions do not work at all. Can anyone please enlighten me on the cause. Any help would be greatfull.... See code below

Don

;;;******LISP FILE**************
(defun c:qq (/ dcl_id status word-list sysvar-list var-list) (setq dcl_id (load_dialog "lblspc.dcl")) (if (not (new_dialog "lblspc" dcl_id))
...
 
Donald Varino schrieb:
I am using Autocad R14 and 2002 and I need this to be able to initiate the dialog (which it does) and the user selects what selections he/she chooses and they will automatically be there selected the next time they go into the dialog again. Also the select all and clear all functions do not work at all. Can anyone please enlighten me on the cause. Any help would be greatfull.... See code below

The code is by fas too long to read to give you a free advice!

When your dialog is called again in the same function, then you can call your dialog in a while loop

(while dialog-callback
(new_dialog "lblspc" dcl_id)
....
(action_tile "cancel" "(setq dialog-callback nil)(done_dialog 0)")
)

Other action-tiles could give back other dialog-callback values ...

When your dialog is called again by calling the whole function again, you should store the selection set in a global variable.

Tom Berger
 
Status
Not open for further replies.

Latest threads

Back
Top