PDA

View Full Version : Break a Loop?



Phillip_Miller
2009-09-02, 12:44 AM
HI.

I'm wanting to break a continuios loop (in a VB.net dll application that has no GUI forms), when a user hits the escape key. How do I go about listning for the the escape button being pressed.

Cheers

Phillip

Kerry Brown
2009-09-02, 09:42 AM
you could try comething like



//did user press ESCAPE?
if (HostApplicationServices.Current.UserBreak())
{
throw new Autodesk.AutoCAD.Runtime.Exception(
ErrorStatus.UserBreak, "ESCAPE pressed");
}
as demonstrated here
http://www.theswamp.org/index.php?topic=29992.0

/// kdub

Coolmo
2009-10-01, 12:28 PM
How can this be used in VB.NET and how would it actually break a loop? Is this placed in the

"Do Until ..." Statement

... or just placed somewhere in the middle of the loop. How would this react with a transaction in progress?

rene.andreas
2010-08-30, 10:21 AM
//did user press ESCAPE?
if (HostApplicationServices.Current.UserBreak())
{
throw new Autodesk.AutoCAD.Runtime.Exception(
ErrorStatus.UserBreak, "ESCAPE pressed");
}


Hi,
I just tried to add the statement with the HostApplicationServices above to my .NET VB addin running on Acad 2008.
But I'm unable to find the given call to the UserBreak().
Where can I find it?

Greetings
René

Kerry Brown
2010-08-30, 12:15 PM
Hi,
I just tried to add the statement with the HostApplicationServices above to my .NET VB addin running on Acad 2008.
But I'm unable to find the given call to the UserBreak().
Where can I find it?

Greetings
René
in 2011 it's in acdbmgd.dll
Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.UserBreak()

appears to not be in 2008.