
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
Am using the above mentioned routine to open a dialogue box with a list of 5 or 6 drawing files that I constantly need to copy details from. Routine is awesome. Only gripe I have is that once the dialogue box is open and I selected from the list, the file I want to open...it opens the delected file but returns focus to the original drawing/file I was working on - not the newly opened drawing from the dialogue box. A minor thing but hopefully it likewise requires only as minor adjustment to focus or stay on the newly opened drawing tab instead of the original. Hope that makes sense. Have included the routine below in case anyone doesn't know what it is and/or save you looking for it. Thanks for reading everyone.
;; List Box - Lee Mac
;; Displays a DCL list box allowing the user to make a selection from the supplied data.
;; msg - [str] Dialog label
;; lst - [lst] List of strings to display
;; bit - [int] 1=allow multiple; 2=return indexes
;; Returns: [lst] List of selected items/indexes, else nil
(defun LM:listbox ( msg lst bit / dch des tmp rtn )
(cond
( (not
(and
(setq tmp (vl-filename-mktemp nil nil ".dcl"))
(setq des (open tmp "w"))
(write-line
(strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select="
(if (= 1 (logand 1 bit)) "true" "false") ";width=120;height=15;}spacer;ok_cancel;}"
)
des
)
(not (close des))
(< 0 (setq dch (load_dialog tmp)))
(new_dialog "listbox" dch)
)
)
(prompt "\nError Loading List Box Dialog.")
)
( t
(start_list "list")
(foreach itm lst (add_list itm))
(end_list)
(setq rtn (set_tile "list" "0"))
(action_tile "list" "(setq rtn $value)")
(setq rtn
(if (= 1 (start_dialog))
(if (= 2 (logand 2 bit))
(read (strcat "(" rtn ")"))
(mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")")))
)
)
)
)
)
(if (< 0 dch)
(unload_dialog dch)
)
(if (and tmp (setq tmp (findfile tmp)))
(vl-file-delete tmp)
)
rtn
)
(Defun c:Open_DWG_Dialogue (/ aDoc filelist dwglist openfile)
(setq aDocs (vla-get-Documents (vlax-get-acad-object)))
(if
(setq filelist nil
dwglist (findfile "C:\\Users\\Brad\\Dropbox\\AutoCad2020\\Actions and LISP\\Open DWG list dialogue box HOME.txt")
);; < -- location of your drawing list
(progn
(setq openfile (open dwglist "r"))
(while (setq fname (read-line openfile))
(setq filelist (cons fname filelist))
)
(close openfile)
(foreach selectedfile
(LM:listbox "Select Files to open" (reverse filelist) 1)
(if (findfile selectedfile)
(vla-open aDocs selectedfile :vlax-false);; < -- opens the file read-only
)
)
)
)
(princ)
)
Solved! Go to Solution.