here i one for machine zero. i use this to set the spindle and then apply tool off sets. i would not try to use this on a diffrent machine its just a example that works for me. your best bet is to goto mach home page and look up and read the cutomizing wiki.
feed = getdro(18) 'gets feedrate
If issuchsignal(22) Then 'checks for probe signal
code "g31 z-7 f35" ' fast move to probe/height sensor set z move to your height
While ismoving()
Wend
sensor = getoemdro(85) 'machine z refrence
pullback = sensor + .1 'add .1 to sensor height
code "g53 g01 z" & pullback 'moves the z axis away from sensor
While ismoving()
Wend
nextmove = getoemdro(85) 'get machine z axis
move = nextmove -.11 ' adds .11 to machine axis for slow move down
code "f1" 'changes feed rate
code "g31 z" & move 'moves the z axis to sensor slow
While ismoving()
Wend
ofst = getoemdro(1001) ' dro that i added for the tool height sensor
code "G4P.10" 'pause 10
While ismoving()
Wend
Call SetDRO(2,ofst) ' sets z axis for program
code "g01 z" & ofst + .25 'sets z axis .25 above sensor
While ismoving()
Wend
code "f " & feed 'feedrate back to normal
End If
End
to find the height of my sensor i take the spindle all the way down to the table and use a guage block to set machine zero then set the sensor up and use another set of code to find the sensor height. there is also another set of probe variblesx=(2000),y=(2001),z=(2002) this gets the actual probe point of contact because the spindle will move past this point while it is coming to a stop. i found out about this after i did the code above and just never went back to change it. (thats why i did a fast probe and a slow probe) you guys really need to read the Wiki and look at the files on the mach group under probing. if i felt it was safe i would write some files for you but you never know how others have their machines set up and it's not a risk i want to take with your equipment. play around and keep you e-stop close.
by tha way i can't remember how many times i crash my machine into the probe.
Last edited by powerr; 12-21-2006 at 07:33 PM.
|