synchronous code execution?

synchronous code execution?

Anonymous
Not applicable
531 Views
4 Replies
Message 1 of 5

synchronous code execution?

Anonymous
Not applicable
in the code example below the userform displays before the sendcommand lines
are completly executed in AutoCad.
is there a way to wait for the sendcommand method to finish before
continuing?
example:
sub test ()
ThisDrawing.SendCommand ("(load ""acad.lsp"") ")
userform1.show
end sub
0 Likes
532 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
You can try to put a timer in your code. Please check the syntax, as I'm
away from my VBA Help.

Dim adStart, adPause
adTime = 3 'this is the pause time in seconds
adStart = Timer
Do While Timer < adStart + adPause
Loop

-- Walter -- http://www.ActiveDwg.com

Corey A. Layton wrote in message
news:[email protected]...
> in the code example below the userform displays before the sendcommand
lines
> are completly executed in AutoCad.
> is there a way to wait for the sendcommand method to finish before
> continuing?
> example:
> sub test ()
> ThisDrawing.SendCommand ("(load ""acad.lsp"") ")
> userform1.show
> end sub
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
You might try looping while

Application.AcadState.IsQuiescent = false

"Corey A. Layton" wrote:
>
> in the code example below the userform displays before the sendcommand lines
> are completly executed in AutoCad.
> is there a way to wait for the sendcommand method to finish before
> continuing?
> example:
> sub test ()
> ThisDrawing.SendCommand ("(load ""acad.lsp"") ")
> userform1.show
> end sub

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* [email protected] */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 4 of 5

Anonymous
Not applicable
thanks for the suggestion.
this works if i call my code from vba editor, or run the macro from the acad
user interface.
for some reason i does not work if i call the macro from LISP.
Might it be because my sendcommand line is a LISP expression? (i know that
acad does not like to re-enter LISP)
anyway, my point is that i have found my code to be always synchronous if
called from VBA, and always asynchronous if called from LISP (command
"-vbarun" etc. no matter what timers or loops i stick between calls to
sendcommand and userform.show.
i wonder why?

Tony Tanzillo wrote in message
news:[email protected]...
> You might try looping while
>
> Application.AcadState.IsQuiescent = false
>
> "Corey A. Layton" wrote:
> >
> > in the code example below the userform displays before the sendcommand
lines
> > are completly executed in AutoCad.
> > is there a way to wait for the sendcommand method to finish before
> > continuing?
> > example:
> > sub test ()
> > ThisDrawing.SendCommand ("(load ""acad.lsp"") ")
> > userform1.show
> > end sub
>
> --
>
> Checkout the AcadX(tm) ActiveX Extension Library at:
>
> http://www.caddzone.com/acadx/acadx.htm
>
> /*********************************************************/
> /* Tony Tanzillo Design Automation Consulting */
> /* Programming & Customization for AutoCAD & Compatibles */
> /* ----------------------------------------------------- */
> /* [email protected] */
> /* http://www.caddzone.com */
> /*********************************************************/
0 Likes
Message 5 of 5

Anonymous
Not applicable
Hi Corey,
Your problem is a typical SendCommand problem
if You send toomany SendCommand continuously also not all the Sendcommands will
be
executed. this can be little bit solved by this

AppActivate AcadCallObject.Caption
But this will slow down your program.

One more doubt
its look that you only load the AutoLISP program but not executing it. Hence its
return back to
form am I write
Reply
N.Murugan
"Corey A. Layton" wrote:

> in the code example below the userform displays before the sendcommand lines
> are completly executed in AutoCad.
> is there a way to wait for the sendcommand method to finish before
> continuing?
> example:
> sub test ()
> ThisDrawing.SendCommand ("(load ""acad.lsp"") ")
> userform1.show
> end sub
0 Likes