@Anonymous wrote:
I used TD.lsp to insert multiple typical details without having to go through the insert screen everytime. I tried to update it so I could specify what details I wanted instead of having to go through the library. Now that I've added a conditional, I get an error message. Please help.
The error comes from this line
(set k (getkword "\nWhich table are you using? [CF/GB/CS/CB/CM/BW/W/PR/SB/ND/CD/MS/TC/PS] :"))
Change it to
(setq k (getkword "\nWhich table are you using? [CF/GB/CS/CB/CM/BW/W/PR/SB/ND/CD/MS/TC/PS] :"))
And you are missing a number of parenthesis on your cond statement
(Cond
( (= k "CF")(foreach ...
...
(foreach ...)
)
)
( (= k "W") (foreach ...
...
(foreach ... )
)
)
);cond
Here is another way to add more options
(defun C:TEST ( / k) ;TYPICAL DETAILS
(setq details "N:\\CAD\\AutoCad Blocks\\Details\\"
library '(( "CF" . ("Block" "Concrete" "Foundation" "Misc" "Foundation"))
( "W" . ("Block" "Misc" "Truss" "Wood"))
)
)
(initget 1 "CF GB CS CB CM BW W PR SB ND CD MS TC PS")
(setq k (getkword "\nWhich table are you using? [CF/GB/CS/CB/CM/BW/W/PR/SB/ND/CD/MS/TC/PS] :"))
(if
(setq f (Assoc k library))
(foreach itm (cdr f)
(if (findfile (strcat details itm))
(foreach dwg (LM:listbox "Select drawing Files" (vl-directory-files (setq path (strcat details itm "\\")) "*.dwg" 1) 1)
(command "_insert" (strcat path dwg) pause "1" "1" "0")
)
)
)
)
(princ)
)
HTH