Good call, I never tested it much actually -
Indeed it is synchronous:
(vla-SendCommand (vla-get-ActiveDocument (vlax-get-acad-object))
(strcat
(vl-prin1-to-string '(command "_.CIRCLE" pause pause)) "\r"
(vl-prin1-to-string '(command "_.LINE" pause pause)) "\r"
)
)
Because the above will instantly prompt for errors when calling the command, or even if its 2 separate calls like this:
(vla-SendCommand (vla-get-ActiveDocument (vlax-get-acad-object))
(strcat
(vl-prin1-to-string '(command "_.CIRCLE" pause pause)) "\r"
)
)
(vla-SendCommand (vla-get-ActiveDocument (vlax-get-acad-object))
(strcat
(vl-prin1-to-string '(command "_.LINE" pause pause)) "\r"
)
)
Would mean that it does its job, sends the string to be executed in the accoreconsole console (the one thats not in VLIDE)..
And returns nil instantly, without waiting the user for inputs from the sended string that was executed.
Maybe thats because the return from the SendCommand method doesn't depent on the execution string's result (it just sends it and instantly returns nil, without having to wait)
Meaning that the LISP code continues evaluating, while the sended string for execution waits for inputs or is just sended with some delay (what a mess).
Now that we observed how it behaves, then why not pass a setvar/getvar expression in it :
(defun C:test ( / doc dsktop fd )
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq dsktop (strcat (getenv "userprofile") "\\Desktop\\"))
(setq fd (getvar 'filedia))
(vla-SendCommand doc
(strcat
"(setvar 'filedia 0)" "\r"
"_.save " dsktop "testBackUp.dwg" "\r"
"(setvar 'filedia " (itoa fd) ")" "\r"
)
); vla-SendCommand
(princ)
)
NOTEs:
"\r" simulates hitting ENTER key
(vl-prin1-to-string '(command ...)) makes easier to write the call