
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello! Thank you ahead of time for anyone who spends any time looking at this. I am currently trying to have my routine identify the customer and send a .dwf to the appropriate reviewer. I can make everything work when I don't have the if statement:
(if (eq pval1 "OPERATIONS")...
I'm trying to use the if statement to decide which folder to send to. As soon as I run the LISP though, I get "Error: bad argument type: consp nil". Any help or suggestions would be highly appreciated and recognized. Thank you.
(defun c:MODDWF ( / file ;file name for TEMP.DSD
OldFda ;system variable FILEDIA
pathtxt ;path where drawing is saved to write TEMP.DSD
nosheets ;number of PDF pages to print
*error* ;error trap
) ;end variables
(vl-load-com)
(cb:writetotext "mod" "MODDWF" )
(defun steal:listbox ( title lst / *error* dch des tmp res )
(defun *error* ( msg )
(if (< 0 dch)
(unload_dialog dch)
)
(if (= 'file (type des))
(close des)
)
(if (and (= 'str (type tmp)) (setq tmp (findfile tmp)))
(vl-file-delete tmp)
)
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
(princ (strcat "\nError: " msg))
)
(princ)
)
(cond
( (not
(and
(setq tmp (vl-filename-mktemp nil nil ".dcl"))
(setq des (open tmp "w"))
(write-line
(strcat
"listbox : dialog { label = \""
title
"\"; spacer; : list_box { key = \"list\"; multiple_select = false"
"; } spacer; ok_cancel; }"
)
des
)
(not (close des))
(< 0 (setq dch (load_dialog tmp)))
(new_dialog "listbox" dch)
)
)
(prompt "\nError loading Steal list box.")
)
( t
(start_list "list")
(foreach item lst (add_list item))
(end_list)
(setq res (set_tile "list" "0"))
(action_tile "list" "(setq res $value)")
(setq res
(if (= 1 (start_dialog))
(mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" res ")")))
)
)
)
)
(if (< 0 dch)
(setq dch (unload_dialog dch))
)
(if (and (= 'str (type tmp)) (setq tmp (findfile tmp)))
(vl-file-delete tmp)
)
res
)
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(setq si (vla-Get-SummaryInfo (vla-Get-ActiveDocument (vlax-Get-Acad-Object))))
(vla-GetCustomByKey si "customer" 'pval1)
(vla-GetCustomByKey si "Site Name1" 'pval2)
(vla-GetCustomByKey si "state" 'pval3)
(vla-GetCustomByKey si "Project Number" 'pval4)
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(if (eq pval1 "OPERATIONS")
((setq tmp (vl-remove-if '(lambda (x) (or (eq x ".") (eq x ".."))) (vl-directory-files "c:/Operations" NIL -1)))
(if (not (eq nil (setq file (steal:listbox "Select Detail File:" tmp))))
(setq openfileLoc (strcat "C:\\Operations\\" (car file) "\\"))
))
((setq tmp (vl-remove-if '(lambda (x) (or (eq x ".") (eq x ".."))) (vl-directory-files "C:/Structural" NIL -1)))
(if (not (eq nil (setq file (steal:listbox "Select Detail File:" tmp))))
(setq openfileLoc (strcat "C:\\Structural\\" (car file) "\\"))
)))
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Solved! Go to Solution.