Break from VB

Break from VB

Anonymous
Not applicable
449 Views
7 Replies
Message 1 of 8

Break from VB

Anonymous
Not applicable
I need send a break to autocad (or esc) with sendcommand method (or similar)
but don´t works to end any pending command.

I use acadobj.sendcommand(chr(27)) but this don´t work.

Any ideas?

Than
0 Likes
450 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
Sendcommands only work when the acadscreen is visible and active. But I
assume that this is the case. When do you want to cancel? Do you want to
cancel a running code? Or do you want to interrupt an user action when an
event is triggered?



"Roddy" wrote in message
news:93AD25005330ED2364EA55EFDD46752B@in.WebX.maYIadrTaRb...
> I need send a break to autocad (or esc) with sendcommand method (or
similar)
> but don´t works to end any pending command.
>
> I use acadobj.sendcommand(chr(27)) but this don´t work.
>
> Any ideas?
>
> Than
>
>
>
>
0 Likes
Message 3 of 8

Anonymous
Not applicable
Public Sub Escape()

'Simulate the Escape key being pressed
On Error Resume Next
ThisDrawing.ActiveDocument.SendCommand Chr$(27)

End Sub

--
Veign
www.veign.com
Code Samples & Sample Projects
http://www.veign.com/information/application/info_app.html
Submit Your Best Code (you keep the rights)
http://www.veign.com/information/application/code_submit.html
---------
"Roddy" wrote in message
news:93AD25005330ED2364EA55EFDD46752B@in.WebX.maYIadrTaRb...
> I need send a break to autocad (or esc) with sendcommand method (or
similar)
> but don´t works to end any pending command.
>
> I use acadobj.sendcommand(chr(27)) but this don´t work.
>
> Any ideas?
>
> Than
>
>
>
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
I need to stop pendings commands like zoom, to permit to select object from
code in VB.

Thanks...

"Joeri Tuyn" escribió en el mensaje
news:18EC0726255090BCF579F64B8C6A47AC@in.WebX.maYIadrTaRb...
> Sendcommands only work when the acadscreen is visible and active. But I
> assume that this is the case. When do you want to cancel? Do you want to
> cancel a running code? Or do you want to interrupt an user action when an
> event is triggered?
>
>
>
> "Roddy" wrote in message
> news:93AD25005330ED2364EA55EFDD46752B@in.WebX.maYIadrTaRb...
> > I need send a break to autocad (or esc) with sendcommand method (or
> similar)
> > but don´t works to end any pending command.
> >
> > I use acadobj.sendcommand(chr(27)) but this don´t work.
> >
> > Any ideas?
> >
> > Than
> >
> >
> >
> >
>
>
0 Likes
Message 5 of 8

Ed__Jobe
Mentor
Mentor
Using SendCommand may not work when you want it to due to the fact that it is asyncronous. Try the following function.

Public Sub CancelCommand()
SendKeys "{ESC}"
End Sub

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 6 of 8

Anonymous
Not applicable
Hmm, tough one. VBA apps won't start when there are
still commands in progress. So no command can be send in a way through vba. No
sendkeys and no sendcommand. If you start your VBA-application with a
button, you can put a cancel command in the commandline behind the button. Or if
you start it through a lisp routine, put a cancel in the routine before starting
you're application. If you start an application with an event in VBA you might
be able to cancel it with sendkeys or sendcommand but I don't think that will
work....

 

 


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
Using
SendCommand may not work when you want it to due to the fact that it is
asyncronous. Try the following function.

Public Sub CancelCommand()
    SendKeys "{ESC}"

End Sub

0 Likes
Message 7 of 8

Anonymous
Not applicable
It sounds like you're trying to initiate a macro from the command line
while in the middle of a command. If that's the case, then I'd say
that's a problem. But it's not just with vba, it's with any acad command
. Even transparent commands can't be initiated from the prompt while in
the middle of something else. You have to kill it with the esc key or
with a ^C^C from a button. But that's normal behaviour.
-Josh

Joeri Tuyn wrote:

> Hmm, tough one. VBA apps won't start when there are still commands in
> progress. So no command can be send in a way through vba. No sendkeys
> and no sendcommand. If you start your VBA-application with a button, you
> can put a cancel command in the commandline behind the button. Or if you
> start it through a lisp routine, put a cancel in the routine before
> starting you're application. If you start an application with an event
> in VBA you might be able to cancel it with sendkeys or sendcommand but I
> don't think that will work....
>
>
>
>
>
> "Ed_Jobe" wrote in message news:f0e512e.3@WebX.maYIadrTaRb...
>
> Using SendCommand may not work when you want it to due to the fact
> that it is asyncronous. Try the following function.
>
> Public Sub CancelCommand()
> SendKeys "{ESC}"
> End Sub
>
0 Likes
Message 8 of 8

Anonymous
Not applicable
To correct myself, you can use transparents from the command prompt but
only with the use of '_
You can't execute a zoom in the middle of a line with Z straight from
the pgp file, you have to use '_Z
0 Likes