Ok I am trying to make a selection window where on the left you can choose a discipline and on the right you could chose from a selection of notes having to do with that discipline. I almost have the right code but the notes list won’t show up I was hoping someone that knows the lisp code could maybe point out my errors in this lisp routine I have copied and tweaked.
Code:; notest.lsp ;---------------------------------------------------------------------------- ; notest.lsp (Insert Standard Notes) ;---------------------------------------------------------------------------- ; ;---------------------------------------------------------------------------- ; Global Variables: : ; None ;---------------------------------------------------------------------------- ; Global Variables: : ; DCL_ID Dialog ID ; LOOKUP_LIST List of Key-Blockname Pairs ; PRE_FIX Front end of Key (ie "TYPE01") ; TYPE_ITEMS List of title block Type strings ; TYPE_LIST List of pairs of TITLE Numbers & Type strings ; TYPE_NUMS List of title block Numbers ; SCALE_ENGLISH_LIST List of pairs of scale strings and values ; SCALE_ENGLISH_NUMS List of scale values ; SCALE_METRIC_LIST List of pairs of scale strings and values ; SCALE_METRIC_NUMS List of scale values ; SUF_FIX Back end of Key (ie "SIZE01") ; TITLE_SCALE Scale factor to insert title block ; TITLE_UNITS Units selected by user ; ;---------------------------------------------------------------------------- ; Internal Functions: ; disable-english Makes English Scale list inactive ; disable-metric Makes Metric Scale list inactive ; enable-english Makes English Scale list active ; enable-metric Makes Metric Scale list active ; err Error handler ; ins-TITLE Inserts title block ; makelist Makes Type list box ; makelist2 Makes English Scale list box ; makelist3 Makes Metric Scale list box ; read-vals Reads dialog values ; update-scale Switches scale lists active/inactive ;---------------------------------------------------------------------------- ; Local Variables: ; BN Block name ; ER Saved error handler ; KEY Key to lookup list items ; OKFLAG Used to check if user selects OK ;---------------------------------------------------------------------------- ; Shared Subroutines: ; getval Returns associated data in a list ; lmake Makes or sets layer ; loadlib Loads shared lisp functions from library ; resetv Resets system variables ; savev Saves system variables ; setscale Sets scale sensitive system variables ; ;---------------------------------------------------------------------------- (if (not loadlib) (progn (if (not LISP_DIR)(setq LISP_DIR "")) (load (strcat LISP_DIR "loadlib")) );end progn );end if (loadlib "getval") (loadlib "lmake") (loadlib "resetv") (loadlib "savev") (loadlib "setscale") ; loads (setscale-vars) (defun C:notest( / DCL_ID LOOKUP_LIST PRE_FIX TYPE_ITEMS TYPE_LIST TYPE_NUMS SCALE_ENGLISH_LIST SCALE_ENGLISH_NUMS SCALE_METRIC_LIST SCALE_METRIC_NUMS SUF_FIX TITLE_SCALE TITLE_UNITS disable-english disable-metric enable-english enable-metric err ins-TITLE makelist makelist2 makelist3 read-vals update-scale BN ER KEY OKFLAG ) ;-----edit type list - these are the names that will appear in the Type list box (setq TYPE_LIST (list (cons "TYPE01" "Mechanical") (cons "TYPE02" "Plumbing") ) );end setq TYPE_LIST (setq SIZE_LIST (list (cons "SIZE01" "notes-mech") (cons "SIZE02" "notes-seismic") ) );end setq SIZE_LIST ;-----to add/edit sizes - edit notest.dcl ;-----edit lookup list - for each line list the type#-size# then the name of ; the block to insert. Replace TITLENAME with the name ; of each of your blocks (setq LOOKUP_LIST (list (cons "TYPE01-SIZE01" "notes-mech") (cons "TYPE01-SIZE02" "notes-seismic") (cons "TYPE01-SIZE03" "notes-seismic-DSA") (cons "TYPE01-SIZE04" "NOTES-planchk HVAC") (cons "TYPE01-SIZE05" "NOTES-T24") (cons "TYPE01-SIZE06" "NOTES-fire protect") (cons "TYPE01-SIZE07" "TSTAT HEIGHT") (cons "TYPE01-SIZE08" "LEG-HVAC DEC") (cons "TYPE01-SIZE09" "Design Criteria") (cons "TYPE01-SIZE10" "DecLogo") (cons "TYPE01-SIZE11" "Sheet notes") (cons "TYPE01-SIZE12" "Sht-Title") (cons "TYPE02-SIZE13" "NOTES-plumb1") (cons "TYPE02-SIZE14" "notes-seismic") (cons "TYPE02-SIZE15" "NOTES-planchk plumb") );end list );end setq LOOKUP_LIST (defun makelist() (start_list "type_sel") (setq TYPE_NUMS ;get each type number (mapcar 'car TYPE_LIST)) (setq TYPE_ITEMS ;get the name of each type (mapcar 'cdr TYPE_LIST)) (mapcar 'add_list TYPE_ITEMS) (end_list) ) (defun read-vals() (get_tile "type_sel") ;add test for item_num nll (if (null ITEM_NUM) (setq ITEM_NUM "0")) (setq PRE_FIX (nth (read ITEM_NUM) TYPE_NUMS)) (setq SUF_FIX (get_tile "size_sel")) ) ;-------main program begins here (defun err (A) ; internal error handler (if (/= A "Function cancelled") (princ (strcat "\nError: " A))) (resetv) (setq *error* ER) (prin1)); end defun err (command "UNDO" "MARK") (setq ER *error* *error* err) (savev '("CMDECHO" "OSMODE" "BLIPMODE" "ATTREQ" "CLAYER")) (setq DCL_ID (load_dialog "notest.dcl")) (if (not (new_dialog "notest" DCL_ID) ) (exit)) (makelist) (set_tile "size_sel" "SIZE01") (set_tile "type_sel" "TYPE01") (setq OKFLAG nil) ;----user dialog (action_tile "type_sel" "(setq ITEM_NUM $value)") (action_tile "accept" "(progn (setq OKFLAG T)(read-vals)(done_dialog 1))") (start_dialog) (unload_dialog DCL_ID) ;----check values, make changes (if OKFLAG ;this doesn't run if cancelled (progn (setq KEY (strcat PRE_FIX "-" SUF_FIX)) (setq BN (getval KEY LOOKUP_LIST)) (if (null BN) (progn (prompt (strcat "\nKey " KEY " not found on lookup_list in notest.lsp.") ) (exit) ));end if (if ;check to see if block exists (or (tblsearch "block" BN) (findfile (strcat BN ".dwg")) );end or (progn (setvar "ATTREQ" 0) (setvar "BLIPMODE" 0) (setvar "CMDECHO" 0) (setvar "OSMODE" 0) (lmake "T") (setq tm (getvar "TILEMODE")) (progn (if (= (getvar "USERR3") 0)(setvar "USERR3" 1)) (if (= tm 0)(setq sf 1)) (if (= tm 1)(setq sf (getvar "USERR3"))) );end progn (prompt (strcat "\nInserting DEC Standard Notes: " BN ));end prompt (setq pt1 (getpoint "\nInsertion Point:")) (command "INSERT" BN pt1 sf "" 0) );end progn (prompt (strcat "\nBlock " BN " not found.")) );end if );end progn );end if (resetv) (setq *error* ER) (prin1) );end defun c:notest (prin1) // notest.DCL //--------------------------------------------------------------------------- // notest.DCL (Insert DEC Standard Notes) //---------------------------------------------------------------------------- // Corresponding dialogue for notest.LSP // //---------------------------------------------------------------------------- notest : dialog { label = "Insert DEC Standard Notes"; : row { : boxed_column { label = " &Discipline:"; : list_box { key = "type_sel"; alignment = left; fixed_width = true; width = 30; height = 10; multiple_select = false; } }//end boxed_column : boxed_column { label = " &Note:"; : list_box { key = "size_sel"; alignment = left; fixed_width = true; width = 30; height = 10; multiple_select = false; } } //end boxed_column }//end row ok_cancel; }//end dialog