I hope the project manager for you project was smart enough to include the additional budget necessary for all of the unnecessary, extra work needed to perform your current task. What a difficult position.
Here's a start:
Code:
(defun c:FOO (/ *error*)
(vl-load-com)
(defun *error* (msg)
(and oldOsmode (setvar 'osmode oldOsmode))
(if acDoc
(vla-endundomark acDoc))
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** ")))) ; Fatal error, display it
(princ))
((lambda (acDoc oldOsmode / basePoint elevation)
(vla-startundomark acDoc)
(if
(and (setvar 'osmode 0)
(setq basePoint (getpoint "\nSpecify a base point: "))
(not (initget 4))
(setq
elevation (getreal "\nEnter base point elevation: ")))
(progn
;; <- do the rest
)
(cond (basePoint (*error* "No elevation entered"))
((*error* "No base point specified")))))
(vla-get-activedocument (vlax-get-acad-object))
(getvar 'osmode)))