Hello Guest it is March 28, 2024, 05:46:30 PM

Author Topic: Auto Z for an ATC  (Read 5571 times)

0 Members and 1 Guest are viewing this topic.

Auto Z for an ATC
« on: August 28, 2011, 06:40:07 PM »
Hey all.
How do I get my Auto-Z value input into the tool "Z 0ffset" DRO field complete with the touch plate thickness added?
As it is now, it enters into the Work Z offset field and does not adjust for the plate thickness. I am using an ATC and I want to key the tool number, Change the tool manually and then run the Auto-Z and have it enter for that tool.
This is what i am starting with:

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 P5" ' this delay gives me time to get from computer to hold probe in place
Code "G31Z-1. F10" '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 Z1." '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


Thanks for your help. Russ.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Auto Z for an ATC
« Reply #1 on: August 28, 2011, 07:21:42 PM »
Getting late here and I am crap at VB anyway so will tell you what I do. I have a toolsetter at the side of my machine where I set up tools off the machine and it has an encoder on it which feeds into Mach. So its a manual process and not really what you want but  here is how I get the info into the tooltable, this is the code in my button. You may be able to use parts of it in your macro, specifically the Code line and maybe look at your Z DRO instead of the encoder DRO that I look at..

If GetOemLED(800) Then
MsgBox ("Mach In Reset, Enable and start again")
End
End If

Offset = GetOemDRO(100) 'This is the Encoder DRO that height setter is connected to

SetOemDRO(1555,Question("Enter Offset Number"))

Tool = GetOemDRO(1555)

Code "G90" & "G10" & "L1" & "P" & Tool &"Z" & Offset
DoOemButton(121)   

Hope this helps a bit, sleep time for me :D
Hood
Re: Auto Z for an ATC
« Reply #2 on: August 29, 2011, 09:16:23 AM »
Hey Hood
What is DoOemButton (121) from you script?
Re: Auto Z for an ATC
« Reply #3 on: August 29, 2011, 09:35:26 AM »
.... till Hood gets back to ya

121 =  Tool Table Save

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Auto Z for an ATC
« Reply #4 on: August 29, 2011, 09:36:01 AM »
That opens the tool table, not really needed but I just like to see and make sure its added the entry correctly. It always has but probably wont the first time I dont look ;D

Hood

ah Russ got there first I see :D
Re: Auto Z for an ATC
« Reply #5 on: August 29, 2011, 09:48:31 AM »
Hi Hood, knew you couldn't be too far away. 
Would your macro actually save the table entry if you didn't Do 121 ?
Maybe it IS necessary ?
Thanks,
Russ

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Auto Z for an ATC
« Reply #6 on: August 29, 2011, 09:56:37 AM »
Russ, it will enter it into the table and it should be fine, it probably wont actually save permanently unless you choose the save option when closing Mach but have never tried.
Hood
Re: Auto Z for an ATC
« Reply #7 on: August 29, 2011, 11:31:17 AM »
Hey guys thanks for the help.
Do you know what the Oem Button code is for the "set tool offset" button? That should put the value into that offset DRO feild and the tool table as you do. Do you know if I need to toggle the "tool offset" led before the "set tool offset?

Russ

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Auto Z for an ATC
« Reply #8 on: August 29, 2011, 02:05:06 PM »
That is a VB button so no OEM code for it.
You can look at the VB in it by going to Operator menu then Edit VB Button and then clicking on that button when its flashing.
Hood
Re: Auto Z for an ATC
« Reply #9 on: August 29, 2011, 07:55:33 PM »
Hey hood
Being a VB, button how can I address the"set tool offset" button from the auto-z macro that I am working on? It would simplify this macro if I can do a " DoOemButton (*********)" or something like that for the "set tool offset" button.