Why did you use *or* at the beginning of codes ?
Because the variable 'acdoc' is intentionally global to avoid repeated calls to
vlax-get-acad-object since this process is time consuming.
Hence, using the 'or' function, I test the symbol 'acdoc' for a non-nil value, and, if nil, I bound the ActiveDocument object to it. Note that 'or' will keep evaluating supplied arguments until an argument returns a non-nil value.
Lee