Hello Guest it is May 31, 2025, 05:44:34 AM

Author Topic: Mach3 to Mach4 Show G98 G99 status  (Read 8346 times)

0 Members and 1 Guest are viewing this topic.

Offline Rimmel

*
  •  284 284
Mach3 to Mach4 Show G98 G99 status
« on: July 17, 2024, 08:33:57 AM »
Hi just converted from Mach3 to Mach4 Lathe. I tend to use G98 (feed per minute mode) unless threading.

In Mach3 there was an on screen indicator showing which mode you were in.

How can I emulate this in Mach4?

thanks

Offline Rimmel

*
  •  284 284
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #1 on: July 17, 2024, 09:40:05 AM »
Additional - this is a problem because I can't seem to set G98 after a G76 threaafing cycle

e.g. In the Gcode below - if I enable the G98 call then the thread stalls at the start of the thread and won't move.

If I don't call it then it works fine HOWEVER then the mode remains set to G99 and not back to G98

Code: [Select]
G99 (Feed per Revolution)
G97 S500 (Constant Speed)
M03 (Spindle Forward)
M08 (Flood)
G00 X10.100
G00 Z10.100  (Rapid move to Clearance Height)
G76 P030060 Q0.01 R0.03 K2
G76 X9.02 Z-19.0 R0.0 P0.44 Q0.03 F0.75
G80
M5
M9
(G98)



Offline Rimmel

*
  •  284 284
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #2 on: August 15, 2024, 08:59:45 AM »
Still for for an on-screen G99 G98 indicator - anyone?

thanks
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #3 on: August 15, 2024, 11:17:35 AM »
Firstly, add this script to the PLC Script and add some LED's to the screen that are labeled however you want them labeled for G98 and G99.
Then Set the LED's appropriately to Output62 for G98 and Output63 for G99.

-------------------------------------------------------
--Custom Scripts
-------------------------------------------------------
--Feed Type:  Per Min or Per Rev
local inst = mc.mcGetInstance()
local FeedType = mc.mcCntlGetPoundVar(inst, 4005)
local Out62 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT62)
local Out63 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT63)
if FeedType == 98 then
    mc.mcSignalSetState(Out62, 1)
else
    mc.mcSignalSetState(Out62, 0)
end

if FeedType == 99 then
    mc.mcSignalSetState(Out63, 1)
else
    mc.mcSignalSetState(Out63, 0)
end

--End Custom Scripts
-------------------------------------------------------

Secondly, the issue you're having with the threading cycle not working with the G98 at the end could be coming from the look ahead on the control.
Add a "/" on the G98 line:   -->   /G98
This forces the control to stop the look ahead at this point. 
Chad Byrd

Offline Rimmel

*
  •  284 284
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #4 on: August 15, 2024, 11:22:03 AM »
Firstly - thank you very much!!! Very much appreciated.

Secondly - It was the ESS causing the problem. I ditched it for a Pokeys57CNC and it is good now. Thank you for replying though.

** Edit - good tip about the look ahead though... another thing learned today. thank you
« Last Edit: August 15, 2024, 11:28:04 AM by Rimmel »

Offline Rimmel

*
  •  284 284
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #5 on: August 16, 2024, 10:47:07 AM »
Firstly, add this script to the PLC Script and add some LED's to the screen that are labeled however you want them labeled for G98 and G99.
Then Set the LED's appropriately to Output62 for G98 and Output63 for G99.

-------------------------------------------------------
--Custom Scripts
-------------------------------------------------------
--Feed Type:  Per Min or Per Rev
local inst = mc.mcGetInstance()
local FeedType = mc.mcCntlGetPoundVar(inst, 4005)
local Out62 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT62)
local Out63 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT63)
if FeedType == 98 then
    mc.mcSignalSetState(Out62, 1)
else
    mc.mcSignalSetState(Out62, 0)
end

if FeedType == 99 then
    mc.mcSignalSetState(Out63, 1)
else
    mc.mcSignalSetState(Out63, 0)
end

--End Custom Scripts
-------------------------------------------------------

Secondly, the issue you're having with the threading cycle not working with the G98 at the end could be coming from the look ahead on the control.
Add a "/" on the G98 line:   -->   /G98
This forces the control to stop the look ahead at this point. 

Just popped back on to say... I tried the code and it works perfectly! - Thank you so much!!

It may sound a little thing but on that machine I do a lot of Dev stuff in Rev/MM mode. Not having a visual confirmation reference was driving me mad.

thanks again.
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #6 on: August 16, 2024, 10:50:37 AM »
That's the beauty of Mach4.  You can customize the screen almost anyway you'd like.  Just get creative with how you display things.  You can just change the status of the LED without using an output, but I don't know the code behind it right off, there are plenty of examples on here, but I know how to get the state of an output or an input simple enough and I can make the LED match that, so that is what I chose; besides, odds are you won't get to output 62 or 63 so who cares.
Chad Byrd

Offline Rimmel

*
  •  284 284
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #7 on: August 30, 2024, 12:27:17 PM »
That's the beauty of Mach4.  You can customize the screen almost anyway you'd like.  Just get creative with how you display things.  You can just change the status of the LED without using an output, but I don't know the code behind it right off, there are plenty of examples on here, but I know how to get the state of an output or an input simple enough and I can make the LED match that, so that is what I chose; besides, odds are you won't get to output 62 or 63 so who cares.

I don't suppose you know what var is used to store the current Feed setting e.g If I typed in G01 x3.0 F60 then mach3 showed you the current rate setting (with in mm per rev or mm per min.)

Mach4 shows tyou actual moving feedrate but not what it's current set to.

thanks
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #8 on: August 30, 2024, 02:13:52 PM »
This is a reference I use frequently.
https://www.machinetoolhelp.com/Applications/macro/system_variables.html
This says the modal F is #4109
Chad Byrd

Offline Rimmel

*
  •  284 284
Re: Mach3 to Mach4 Show G98 G99 status
« Reply #9 on: August 31, 2024, 06:47:23 AM »