Hello Guest it is May 13, 2021, 02:12:32 AM

Author Topic: Lua Scripting with CycleStop()  (Read 199 times)

0 Members and 1 Guest are viewing this topic.

Lua Scripting with CycleStop()
« on: December 27, 2020, 03:54:20 PM »
Hello together,

I am a fresh forum user. So apologies if I do something wrong here.

I have a problem using my CNC Lathe. I installed an ServoDrive for the spindle. It all works good, but when I use the "Stop" Button on the Lathe Screen the Spindel goes instantly to zero and starts again to go ramped to zero.

I took a look in the ScreenScript and found the CycleStop() function

function CycleStop()
    mc.mcSpindleSetDirection(inst, 0);
    mc.mcCntlSetLastError(inst, "Cycle Stopped");

the mc.mcCntlCycleStop(inst) makes the "0" command. When the function is not called the spindle goes normally to "0" in a ramp as it does when I push the M4 and M3 Buttons on the screen.
Is it possible to access the function mcCNTLCycleStop(inst) in any way to take a look what there is programmed?

Re: Lua Scripting with CycleStop()
« Reply #1 on: December 27, 2020, 09:16:59 PM »
this post would be best on the Mach4 General discussion board, no doubt Tweakie will shift there.

You should not be using Stop (or CycleStop) to stop a job, a hard stop like that decelerates at max and you will lose reference.
The correct procedure is <FeedHold> followed by <Stop>. A <Stop> by itself aborts whatever remaining moves in the motion buffer,
therefore Mach thinks its has made those moves and it at position (x,y,z) when in fact those were aborted and is at position (r,s,t).
A <FeedHold> on the other hand allows the remaining moves, commonly 150ms worth, to execute and drain the motion buffer and
Mach will arrive at (x,y,z) with no loss of reference.

My wife left with my best friend...
     and I miss him!
Re: Lua Scripting with CycleStop()
« Reply #2 on: December 31, 2020, 09:58:26 AM »
Another thing to try is under Configure-> Control General tab. Select Cycle Stop Is controlled Stop? checkbox...

Feed hold is the most correct way but it's your machine ;)
Fixing problems one post at a time ;)