MAch 3 touchplate script error

Forum for Discussing Mach3/4 related issues

MAch 3 touchplate script error

Postby gills » Mon May 26, 2025 3:32 am

script error.PNG
I have been using this same basic touch plate script for years. And now for some reason Mach 3 icannot read it and is giving me this script error message. I am running Windows 10 on my laptop
gills
 
Posts: 66
Joined: Fri Mar 25, 2022 7:42 pm

Re: MAch 3 touchplate script error

Postby KenR » Mon May 26, 2025 11:48 am

On top try the operator tab, then click edit button script. Does the touchplate button flash? If so, you can click the button to view and edit the script.
Either install your backup copy in this way, or post it here so someone might see what happened to it.
KenR
 
Posts: 5
Joined: Mon May 26, 2025 11:31 am

Re: MAch 3 touchplate script error

Postby gills » Mon May 26, 2025 4:43 pm

Here is the script that I have loaded into Mach 3

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .500) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
gills
 
Posts: 66
Joined: Fri Mar 25, 2022 7:42 pm

Re: MAch 3 touchplate script error

Postby KenR » Tue May 27, 2025 4:15 am

Try at your own risk, but Mine is below. Touch plate thickness will need to be adjusted

REM Updated 11 Feb 2018
REM Request Material Thickness offset
Rem Auto Tool Zero Z - Imperial 2 pass Version

DownStroke = -10 'Set the down stroke to find probe
DownFeedRate = 10 'Set the down FeedRate
RetractStroke = .2 'Set the retract Stroke
RetractFeedRate = 20 'Set the retract FeedRate
PlateThickness = 0.75 'Enter Z-plate thickness here
SmallRetractStroke = 0.04 'Retract 0.04" for a 2nd pass
SmallDownFeedRate = 3 'Set the slow down FeedRate for 2nd pass
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

REM 1st Pass at fast rate

Code "(Z axis 1st pass)" 'puts this message in the status bar
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, 0) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1 Z" &SmallRetractStroke &" F" &RetractFeedRate 'retract
While IsMoving ()
Wend
Code "(Z axis 2nd pass)" 'puts this message in the status bar
Else
Code "G0 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection or stroke and try again)" 'puts this message in the status bar
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If

REM 2nd pass at slow rate

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P1" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z" &DownStroke &" F" &SmallDownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, PlateThickness - offset) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
Code "G4 P0.25" 'Pause for Dro to update.
Code "G53Z0"
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
Code "G0 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection or stroke and try again)" 'puts this message in the status bar
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub
KenR
 
Posts: 5
Joined: Mon May 26, 2025 11:31 am

Re: MAch 3 touchplate script error

Postby gills » Tue May 27, 2025 11:52 pm

Thank you for the touch plate script. I will give it a test and see what it does
gills
 
Posts: 66
Joined: Fri Mar 25, 2022 7:42 pm

Re: MAch 3 touchplate script error

Postby gills » Fri May 30, 2025 1:03 am

Ken, I got MAch 3 to readmy original script and your script. Now when the Z lowers and makes contact with the plate it isn't reading the touch and continues to drive the bit into the plate.
gills
 
Posts: 66
Joined: Fri Mar 25, 2022 7:42 pm

Re: MAch 3 touchplate script error

Postby ger21 » Fri May 30, 2025 10:42 am

If you touch the plate to the tool, does your digitize LED on the screen light up?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2806
Joined: Sat Sep 03, 2016 2:17 am

Re: MAch 3 touchplate script error

Postby KenR » Sat May 31, 2025 12:25 am

To add to what Ger said, you can find it on the diagnostic page within mach
KenR
 
Posts: 5
Joined: Mon May 26, 2025 11:31 am

Re: MAch 3 touchplate script error

Postby gills » Sat May 31, 2025 2:11 am

breakout board.jpg
Ger and Ken, on the diagnostic page the digitize LED is not lighting up when you touch the plate to the bit. I don't know why it stopped working. I even soldered a new 2 pin GX 16 connector and put it in to the controller. I just got a UC400 ethernet
controller and run a basic DB25 breakout board to it. It is wired just like the diagram shows. The E-stop is a 2 pin connection and is wired the same way. The led light does light up on the diagnostics page when I activate it.
Attachments
db25 wiring.JPG
gills
 
Posts: 66
Joined: Fri Mar 25, 2022 7:42 pm

Re: MAch 3 touchplate script error

Postby ger21 » Sat May 31, 2025 12:03 pm

You might not have any conductivity through the spindle.
It's not going to work until the LED lights up, every time you touch it.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2806
Joined: Sat Sep 03, 2016 2:17 am

Next

Return to Mach3/4 Discussions

Who is online

Users browsing this forum: No registered users and 0 guests