Don, here are some commented alterations to the code you posted. You might just find some answers to your questions in there.
(defun CONTINUE-ON (/ REGION# DWGTYPE RNAMES DCL_ID myAction)
(setq REGION# "R3")
(setq DWGTYPE "FP")
(setq RNAMES '("R3" "R4" "R8" "R9" "R11"))
(setq dcl_id (load_dialog "Gset.dcl"))
;; I like to use COND instead of (if (not (new_dialog ...))(exit)).
;; First off, I don't like EXIT or QUIT and secondly, you get a
;; nice wrap-around of all dialog-based calls
(cond
((new_dialog "Gset" dcl_id)
(start_list "selections")
(mapcar 'add_list RNAMES)
(end_list)
(action_tile "rb1" "(setq DWGTYPE \"FP\")")
(action_tile "rb2" "(setq DWGTYPE \"SR\")")
;; If you're using the default OK & Cancel buttons, there's
;; no need to assign actions - they are precoded.
;; You do need to set REGION#, though. But you are setting
;; a default value at the beginning so there's no need to
;; read it if the user didn't select anything else.
;; Why not put assigment of REGION# where it belongs: the
;; popup (or list_box?) where the user selects it?
;; This will assign REGION# to whichever item the user
;; selects - WHEN he/she makes a selection:
(action_tile "selections" "(setq REGION# (nth (atoi $value) RNAMES))")
;; How to get the button hit on exit?
;; START_DIALOG returns a value that is normally defined by
;; DONE_DIALOG. But the predefined OK and Cancel buttons return
;; 1 and 0, respectively (if they've not been overriden by other
;; tiles)
(setq myAction (start_dialog))
)
)
(unload_dialog dcl_id)
;; Check if OK was hit. If so do your stuff, otherwise do nawt
;; Pass local vars as arguments to DO_WORK5
(if (= myAction 1)
(DO_WORK5 REGION# DWGTYPE)
)
;; no need to set vars to nil if they're localized
;; (setq REGION# nil .. etc. deleted
(princ)
)
(defun DO_WORK5 (REGION# DWGTYPE)
;; After inspecting the DWGTYPE argument, pass
;; the arguments to the lucky function
(if (= DWGTYPE "FP") (FP-DWG REGION# DWGTYPE))
(if (= DWGTYPE "SR") (SR-DWG REGION# DWGTYPE))
;; This below I'm won't comment
(while (equal 8 (logand 8 (getvar "undoctl")))
(command "_.undo" "_end")
)
(while (not (equal 8 (logand 8 (getvar "undoctl"))))
(command "_.undo" "_begin")
)
)
(defun FP-DWG (REGION# DWGTYPE)
(DO-ALL)
;; If you're using REGION# or DWGTYPE in C:INSERTDIM
;; then make sure they are passed as arguments
(C:INSERTDIM)
(setq RLAYER (strcat REGION# DWGTYPE))
(eval (list (read (strcat "C:" RLAYER))))
(princ)
)
(defun SR-DWG (REGION# DWGTYPE)
(DO-ALL)
(setq RLAYER (strcat REGION# DWGTYPE))
(eval (list (read (strcat "C:" RLAYER))))
(princ)
)
;; Important: one of the changes here makes the document
;; object a local variable that is released after use! If you
;; are using it as a global variable somewhere else then make
;; sure you are getting the doc in those routines, also.
;; Alternatively, don't adopt the changes!
(defun DO-ALL (/ doc)
(command "audit" "y" "")
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-AuditInfo doc :vlax-true)
(repeat 3
(vla-PurgeAll doc)
)
;; No need to use the slow COMMAND for this one
(setvar "LIMMAX" '(10000.0 10000.0))
;; Why not regen with the document already at hand?
(vla-regen doc acAllViewports)
;; Don't go without cleaning up
(vlax-release-object doc)
;; If this is not the last routine then it'd be good
;; to remove the PRINC if it's included somewhere else
;; (and it is :)
(princ)
)