Stop VB code until AutoCAD command is executed.

Discussion in 'AutoCAD' started by mgrigoriev, May 12, 2004.

  1. mgrigoriev

    mgrigoriev Guest

    Hi,
    I send a command to AutoCAD:
    ThisDrawing.SendCommand "_-boundary" & vbCr
    and expect a user to pick the boundary point.
    I want my VB code to wait until the command is finished and proceed when a user picks point(s). The code never stops, and AutoCAD is disabled until the code is fully executed. I tried implementing the EndCommand event, but it didn't work for me. I guess I never learned how to use it.
    Thanks,
    Mike
     
    mgrigoriev, May 12, 2004
    #1
  2. Try using a loop checking

    ThisDrawing.Application.GetAcadState.IsQuiescent

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
    (sorry, phony e-mail, SPAM made me do it)

    user picks point(s). The code never stops, and AutoCAD is disabled until the
    code is fully executed. I tried implementing the EndCommand event, but it
    didn't work for me. I guess I never learned how to use it.
     
    Jorge Jimenez, May 12, 2004
    #2
  3. If you are not executing your command from a hidden VB form, you
    can try starting your MACRO using this, instead of VBARUN:

    (defun C:VBARUNX ()
    (vl-load-com)
    (vla-runmacro
    (vlax-get-acad-object)
    (getstring "\nMacro name: ")
    )
    (princ)
    )

    I can't say for sure if it will work, but its worth a try. If that does
    not work, there is an alternative (AcadX, available at the website
    below).




    and AutoCAD is disabled until the code is fully executed. I tried implementing the EndCommand event, but it didn't work
    for me. I guess I never learned how to use it.
     
    Tony Tanzillo, May 12, 2004
    #3
  4. mgrigoriev

    mgrigoriev Guest

    Jorge, the loop just hangs the computer. Do you have any ideas how to avoid that?
     
    mgrigoriev, May 12, 2004
    #4
  5. That's because ACAD is still waiting for some user interaction.

    Maybe trying another approach is the answer.

    Why not pick the points before using the sendcommand ??

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
    (sorry, phony e-mail, SPAM made me do it)
    avoid that?
     
    Jorge Jimenez, May 12, 2004
    #5
  6. mgrigoriev

    Jeff Mishler Guest

    Done!


    allowed" to download files from.
     
    Jeff Mishler, May 12, 2004
    #6
  7. mgrigoriev

    Jeff Mishler Guest

    Heh, that I do not know. I just posted it from the website. But seeing how
    most arx routines need to be recompiled from version to version, it doesn't
    surprise me.

    Jeff
     
    Jeff Mishler, May 12, 2004
    #7
  8. mgrigoriev

    Ed Jobe Guest

    Why do you say that?

    --
    ----
    Ed
    ----
    Soooo... I take it this is not a viable solution for 2004 or higher, huh????

    --
    Matt W

    There are 3 kinds of people:
    Those who can count, and those who can't.
     
    Ed Jobe, May 12, 2004
    #8
  9. Did you try the simple LISP code I posted?
     
    Tony Tanzillo, May 13, 2004
    #9
  10. mgrigoriev

    mgrigoriev Guest

    Ok, I figured out this one. I put the EndCommand event into ThisDrawing. In the EndCommand event I called another procedure. This way my code will not continue until the EndCommand triggers. Of course, I had to figure out how to send text into the ThisDrawing code.
    Thanks everyone!
    Mike
     
    mgrigoriev, May 13, 2004
    #10
  11. I'm execution the command from a hidden form and the problem persists. Is
    there a solution like AdcgSendCmdSync?

    Thanks
     
    André Dantas Rocha, Oct 29, 2004
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.