Hi all,
If anyone can help,
Having a problem with a macro,which was posted awhile back on
zeroing a tool with a touch plate.
I am using the latest version of Mach and with a G100 GREX (could be the problem?)and stepper motors.
and very limited knowledge of scripting etc,however have read alot of posts on the subject .
The problem appears to be around the line Code "G0 Z" &ZProbePos 'go back to that point
as everything works up until there.
I position the tool over the plate about 1mm
run the macro with the M command
The Z axis zero`s.........The tool comes down and stops on the touch plate
and returns in the plus direction to about 18 - 19mm (varies each time I do it)........then the Z axis changes to 12mm .....then the Z axis positions to 38.## - 39.##mm
Here is the macro Iam using ,also I have only changed ,Plate thickness = 12
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
PlateThickness = 12
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" ' two second delay
Code "G31 Z-20 F100" 'Z goes down a max of 20mm at 100mm/min
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the axact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point
While IsMoving ()
Wend
Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code "G0 Z20" 'retract Z to 20 mm
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)"
Exit Sub
End If
I know if I change the feed rate in this line of the script (Code "G31 Z-20 F100"
it changes the distance that z axis goes to after it touches the plate.
F100 z axis goes to about 10mm
F200 Z axis goes to about 5mm
My guess is the macro is looking at and computing the feed rate DRO ,but how can I tell
Maybe its a another G100 thing,but if anyone can help,that would be great.
Regards
Whatda?