Machsupport Forum
Mach Discussion => Mach SDK plugin questions and answers. => Topic started by: Steffen_Engel on May 26, 2008, 08:23:26 AM
-
Hi,
I'm working at a plugin for Mach3 which will implement some movement.
At the moment it is normal VBA as screen buttons but due to the size of the screenset and software maintenance it is of interest to transfer the code to a DLL/Plugin.
Everything is working fine and on the basics of the plugin-tutorial it was just a simple way to the first code (thanks to James for this nice work).
Now as an example my problem:
Code("g01x1000");
while(IsMoving())
{
Sleep(10);
}
Code("g01x2000");
while(IsMoving())
{
Sleep(10);
}
Now if there is ESCAPE pressed while doing the first move, this move is stopped, then the second move is done.
With VBA the whole script is stopped.
My intention is to stop the whole script as in VBA and so I need the information, if movement has been stopped by the user (or some other condition).
So my code would be
try
{
Code("g01x1000");
while(IsMoving())
{
Sleep(10);
}
if (MovementHasBeenEscaped())
{
throw (ESCAPEDMOVEMENT);
}
Code("g01x2000");
while(IsMoving())
{
Sleep(10);
}
}
catch(int breakcode)
{
}
So, what chance do I have to implement MovementHasBeenEscaped()?
I sought at TractoryControl, Engine an Mach4View, but until now I did'nt find a way to check for the break.
By, Steffen
-
Hi Steffen,
I don't know how to check for escape but you can test for movement by doing this:
if (! Engine->Axis[CurrentAxis].Jogging)
{
//We are not moving so run ESCAPEMOVEMENT
}
See ShuttleWin.CPP in the SDK for more info.
Lee
-
Hi Lee,
But it's normal, that movement will stop (in this example at position x=1000 ;))
I',m looking for a detection of the user aborting the function.
At the moment there is a solution by the callback function Notify but the problem is, that the plugin has to be activated to get Notify.
So now I'll insert a check for he plugin to be activated with a message to the user to ativy it, it necessary.
Bye, Steffen
-
Hi,
Why not just check the current XY position and assume the move was aborted if it is not the commanded position?
-James
-
Hi,
this would be ok for my example, but not for general.
I use abstration of situations (oop), so the check for the break does not know at all, what movement has to be done.
At the moment there are two useable solutions:
-clear the error message and check if there ha arised a new message
-use the plugins notify and ensure, the plugin is active
If there would be a way to activate a plugin by the plugin itself, it would be great.
Bye, Steffen
Hum, I believe, this is no good english, hope you understand...
-
I have an other issue... yet again... :-P
Want to add a counter to the escape button which goes up everytime the button is pressed...
sounds easy using brains and stuff but how do i get the "esc" button press in brain control?
Cheers