比加尔,rlx谢谢你的帖子。
由于我仍在学习LISP,此时我发现很难调用Lee的函数(并替换dos\u multilist)。
这些都是程序和我做的小改动:
- ;; created by Stefan BMR
- (defun c:plotview ( / acobj acdoc views view_list [color="red"]LISTBOX[/color])
- (setq acobj (vlax-get-acad-object)
- acdoc (vla-get-activedocument acobj)
- views (vla-get-views acdoc)
- )
- (vlax-for view views
- (setq view_list (cons (vla-get-name view) view_list))
- )
- (foreach view ([color="red"]LISTBOX[/color] "PLOT SELECTED VIEWS" "Select views to plot" view_list)
- (command
- "_plot"
- "_y"
- "Model"
- "DWG To PDF.pc3"
- "ARCH C (24.00 x 18.00 Inches)"
- "Inches"
- "Landscape"
- "No"
- "View"
- view
- "Fit"
- "Center"
- "Yes"
- "ICP.ctb"
- "Yes"
- "A"
- (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) " - " view ".pdf")
- "No"
- "Yes"
- )
- )
- (princ)
- )
- ;;Created by Lee Mac
- ;; 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=50;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
- )
希望有人能帮我完成这项任务
非常感谢。 |