Hello Guest it is June 25, 2019, 12:34:35 AM

Author Topic: Getting feedback from mach  (Read 2093 times)

0 Members and 1 Guest are viewing this topic.

Getting feedback from mach
« on: November 17, 2013, 08:25:31 PM »
I need to get feedback to another software after Mach has executed a gcode move. I tried using the incremented lin number on the screen but it increments at the start of the move and before the move is complete. I am triggering another software to do something else after every Gcode move and I am currently using timers to approximate how long the gcode moves will take. This of course is not always accurate depending on the last location of the head. Are there any triggers in Mach that update after the move is complete? Any other way of getting a trigger to another software or updating the screen after a move is complete? Thanks
Re: Getting feedback from mach
« Reply #1 on: November 17, 2013, 08:39:28 PM »
In your G-code program, set an output or Var using a custom M-code, and have a macropump monitoring that output or Var.  When it sees it get set, send the signal to the other device, then clear the output or Var.  When the the output or Var toggles, all G-codes up to that line WILL have completed execution.

Regards,
Ray L.
Regards,
Ray L.
Re: Getting feedback from mach
« Reply #2 on: November 17, 2013, 09:10:16 PM »
Thanks for your answer. I will research custom m codes and macro pumps. Any suggestions on how I can send a signal to the other software? I am using an automation software called autoIT that has a lot of scripting abilities but I have not figured out how to get Mach to send a signal to it.

Offline Zaae

*
  •  115 115
    • View Profile
Re: Getting feedback from mach
« Reply #3 on: November 19, 2013, 12:58:05 PM »
One of my rather blunt hammer sort of solutions was to have mach write a file to the hard drive during tool changes by modifying the m6start and m6end m1s files. An autohotkey script on the other computers on the network checks every 10 seconds to see if the file exists, and if it does, it brings up a notification saying what tool is next. I believe autoIT is similar to autohotkey. I will warn you though, I have a rather old computer running my machine, and if I run autohotkey scripts on that machine that do any sort of looping, my machine stepper motors begin to stall. To solve that problem, the looping portion is done on the other computer.
Re: Getting feedback from mach
« Reply #4 on: November 20, 2013, 08:30:25 AM »
I have got it to work by doing the following.
I am using m6 tool change to read an OEM dro, add something to it and set the OEM dro after every move and then Sets m1 that pauses the application. I have modified the screen to show the OEM dro which gets updated after every move. In Autoit I am using the pixcelcheksum function that looks for change in a specific coordinates of the screen to trigger the next action.
M6
x = getUserDRO(1200)
If x > 100 Then x=0:setUserDRO(1200, x)
x=x+11.1111
While IsMoving()
Wend
setUserDRO(1200, x)
code" m1"

The sequence is
1. autoit loads the gcode file in mach3
2. autoit triggers cycle start in Mach3 and runs the pixelcheksum function.
3. mach3 runs the first gcode line and the next line is always m6.
4. When the DRO change is seen due to change in the pixels autoit triggers another software to do its thing.
5. The process is then repeated as necessary.

The mach3 window must always be sized properly and be on top for this to work but so far it looks very promising.

For those interested, I am using this to control a 3d full body scanner. Mach3 runs the up/down, tilt and rotary table and another software controls the scanning. By controlling the entire process automatically with autoit, a full body scan can be done with one key stroke.
You can see the working of the scanner at https://www.youtube.com/watch?v=DqXBjfkeJwE

Offline Zaae

*
  •  115 115
    • View Profile
Re: Getting feedback from mach
« Reply #5 on: November 20, 2013, 08:55:46 AM »
HA! Wow, very impressive, thanks for the video :)