Hi All
The script below must have been seen by a lot of users using cnc machines and mach3. A lot of the lines are self explained, but this is the problem i had trying to make this script work for me.
The whole procedure woks fine, and the toolbit moves down , touches the touchplate that is 2mm thick and moves back up. Mach3 tells that machine Z is now ZERO-ed.
The problem i had was this. I had to tell mach3 that my plate was 2.7mm thick and not 2mm in order to get the toolbit to be exactly on the workpiece surface.
Before the toolbit was always like 1 mm , sometimes 2mm and other times .5 mm above the workpiece surface.
Now i realized that all machines and hardware are different in setup than just inserting the script and expect it to work will not be as easy.
I want to know now, what setting is causing this . My machine is calibrated on the z-axis , so 15mm is 15mm when i use the motor calibration option. Below is the script.
Thanx in advance everyone.
Andre
PlateThickness = 2.0 'Z-plate thickness DRO ' This option i had to change to 2.7mm in order to get it to work properly.
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 P5" ' this delay gives me time to get from computer to hold probe in place
Code "G31 Z-0.5 F5" '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 axact 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, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code "G0 Z 20.0" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub
End If