Welcome, Guest. Please login or register.
Did you miss your activation email?
December 01, 2008, 10:38:59 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Mach SDK plugin questions and answers.
| | |-+  How to check for a break of movement (ESC)
Pages: 1   Go Down
Print
Author Topic: How to check for a break of movement (ESC)  (Read 964 times)
0 Members and 1 Guest are viewing this topic.
Steffen_Engel
Active Member

Online Online

Posts: 4


View Profile
« on: May 26, 2008, 07: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:
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
Code:
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
Logged
Leed3
Active Member

Offline Offline

Posts: 47


View Profile
« Reply #1 on: July 04, 2008, 12:59:28 AM »

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
 
Logged
Steffen_Engel
Active Member

Online Online

Posts: 4


View Profile
« Reply #2 on: July 04, 2008, 05:13:16 AM »

Hi Lee,

But it's normal, that movement will stop (in this example at position x=1000 Wink)
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



Logged
jemmyell
Active Member

Online Online

Posts: 70


View Profile WWW
« Reply #3 on: July 07, 2008, 02:04:00 PM »

Hi,

Why not just check the current XY position and assume the move was aborted if it is not the commanded position?

-James
Logged

Steffen_Engel
Active Member

Online Online

Posts: 4


View Profile
« Reply #4 on: July 07, 2008, 04:56:26 PM »

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...
« Last Edit: July 07, 2008, 04:58:36 PM by Steffen_Engel » Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!