Hello Guest it is January 27, 2021, 01:48:10 AM

Author Topic: Offset and Probe Help  (Read 17177 times)

0 Members and 1 Guest are viewing this topic.

Offline AVRnj

  •  52 52
    • View Profile
Offset and Probe Help
« on: May 18, 2015, 08:48:24 AM »
I am trying to get my Probe working in Mach3, so I entered 2 tools into my tool table, tool 99 (my probe) at 6.5 height, and tool 30 at 4 height.

I went into the offset tab in Mach3, and I am using the following macro for Z:
Code: [Select]
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

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-1.0 F5" 'Z goes down a max of 1.0 at 5IPM
While IsMoving() 'wait while it happens
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 ()
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 Z1.0" 'retract Z to 1.0 inch
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub
End If

When I enter tool 99, the offset light goes green, as I would expect. If I run that macro, it touches, and starts retracting, and then it actually goes up the full 6.5 from the offset, than an extra 1" for the Z1.0, and then it sets my DRO at 1, which is actually way off.

If I manually turn the offset off, and run the macro, it behaves as I would expect, it touches down, retracts 1, and sets the DRO at 1. The problem is, if I do that with the offset off, when I change tools, it does not change the DRO, which is exactly what I would expect.

So, it seems as though I need to use the offsets, but my macro is not working correctly. Can anyone help me out here with this? I have tried a few different macros for this tand they all behave the same way.

Any help would be appreciated
Re: Offset and Probe Help
« Reply #1 on: August 07, 2015, 04:59:01 AM »
Don't know if you figured this out ? I'm having the same problem.
The code above fails when G43 is active, right ?

I think the problem lies within the GetVar(2002) as this takes the ToolLengthOffset into consideration when G43 is active.
Try to put in a message after the GetVar(2002) line
Message "The value of GetVar 2002 = " & ZProbePos
Sleep(5000) 'Wait 5 sec

Then you can see the values is different depending weather G43 is on or off !

I'm planning on in my code, to check, is G43 is ON ?
If it is, turn it off, and then run the probe routine.

After the probe routine, read the ToolLengthOffset from the tooldatabase
GetToolParam(CurrentToolNum,2) and add (+) the value to the z-axis DRO

And then Re-enable the G43
Code "G43 H" & CurrentToolNum