I'm wondering if it's possible to retrieve and store the status of the cutter comp (G-code 41 or 42) using a VB button script.
I've got some center and z-height fixtures that I've made up using info from another thread, and here's what I'd like to do:
1) Retrieve and store the status of the cutter comp (G-code 41 or 42) using a VB button script.
2) Use the script to cancel it with G40, then run the auto tool zero script listed below.
3) Run the appropriate g-code (again G41 or G42) to get back to where I started. This would all be written into the VB script for the Auto Tool Zero button.
I have already made some center and Z height fixtures, and got them to work using a VB script. Here's the problem, I'd like to be able to run the script in the middle of a program upon a tool change. When I try it, a couple of odd things happen. I get the message "Cannot probe with cutter radius comp on" and at other times, "Cannot change units with cutter radius comp on Line number #0". This latter one occurs when using the "Run from here" command, I think.
There may be an easier way to do this, and if so, I'm all ears!! Thanks in advance!
Here's the VB Script as I currently have it below for your reference.
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
Code "G40" 'This is to cancel the modal G41 or G42 code. (Added by mr. technical)
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 "G31Z-2 F5" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
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 ()
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.3" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable