I'm trying to make a lisp that will either insert a block or open a file depending on user input. It works when I test it line by line, but it doesn't execute well when I run the command. Any suggestions will be greatly appreciated. This is what I have so far.
;---------------------------------------------------------------------------------------------
(defun C:LaSetup(/ ANS ONT DISP FILENME ACAPP ACDOCS)
(setq FILENME "P:/Layering/Layers/E0-Elec.dwg")
(setq ans(strcase(getstring "Enter A for all layers F to open File? ( A/F ) :")))
(setq ont "notnil")
(while ONT
(if (= (wcmatch ans "A,F") nil)
(setq ans(strcase(getstring "Input must be 'A' or 'F'")))
(setq ont nil)
)
)
(if (= ans "A")(command "-insert" FILENME "0,0" "1" "1" "0" "erase" "l" ""))
(if (= ans "F") (progn
(setq acApp (vlax-get-acad-object))
(setq acDocs (vla-get-documents acApp))
(vla-open acDocs FILENME)
)
)
);End of file