3931
VB and the development of wizards / Re: tool change?
« on: August 02, 2007, 10:19:04 AM »
Hey Swets,
I think this is what you want.
Response = MsgBox ( "Would you like to set your Z height automatically? If so, click OK", 1 ) 'these two lines are for safety
If Response = 1 Then
'Get the tool change pos from the settings page
ChangeX = GetOEMDRO(1200)
ChangeY = GetOEMDRO(1201)
ChangeZ = GetOEMDRO(1202)
Code "G00 G54 Z2" 'This line moves the Z to +2 in work coord to clear your part.
Code "G00 G53 X" & ChangeX & "Y" & ChangeY 'This moves your X and Y to the TCP DROs on the settings page in Machine coord.
Code "G00 G53 Z" & ChangeZ 'This moves your Z to the TCP DROs on the settings page in machine coord
Response = MsgBox ( "Give your machine time to get to the tool change position. Once there, change your tool and click OK to proceed. The next move will be your Z looking for your plate.", 1 )
If Response = 1 Then
CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness =0.062 'You can adjust this number for your plate thickness
ProbeFeed = 5 'Rate the tool will drive to the touch plate
Code "G90 F" &ProbeFeed
If GetOemLed (825)=0 Then
'Code "G4 P5" 'Time to get to the z-plate
Code "G31Z-5 F" &ProbeFeed
While IsMoving()
Wend
Code "G4 P0.25"
ZProbePos = GetVar(2002)
Code "G0 Z" &ZProbePos
While IsMoving()
Wend
Call SetDro (2, PlateThickness)
Code "G4 P0.5" 'Pause for Dro to update.
Code "G0 Z0.25" 'Change the Z retract height here
Code "(Z axis is now zeroed)"
Code "F" &CurrentFeed
Else
Code "(Z-Plate is grounded, check connection and try again)"
End If
End If
End If
Play with it a little before you try to use it. Try it in the air and make sure the moves are right.
Brett
I think this is what you want.
Response = MsgBox ( "Would you like to set your Z height automatically? If so, click OK", 1 ) 'these two lines are for safety
If Response = 1 Then
'Get the tool change pos from the settings page
ChangeX = GetOEMDRO(1200)
ChangeY = GetOEMDRO(1201)
ChangeZ = GetOEMDRO(1202)
Code "G00 G54 Z2" 'This line moves the Z to +2 in work coord to clear your part.
Code "G00 G53 X" & ChangeX & "Y" & ChangeY 'This moves your X and Y to the TCP DROs on the settings page in Machine coord.
Code "G00 G53 Z" & ChangeZ 'This moves your Z to the TCP DROs on the settings page in machine coord
Response = MsgBox ( "Give your machine time to get to the tool change position. Once there, change your tool and click OK to proceed. The next move will be your Z looking for your plate.", 1 )
If Response = 1 Then
CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness =0.062 'You can adjust this number for your plate thickness
ProbeFeed = 5 'Rate the tool will drive to the touch plate
Code "G90 F" &ProbeFeed
If GetOemLed (825)=0 Then
'Code "G4 P5" 'Time to get to the z-plate
Code "G31Z-5 F" &ProbeFeed
While IsMoving()
Wend
Code "G4 P0.25"
ZProbePos = GetVar(2002)
Code "G0 Z" &ZProbePos
While IsMoving()
Wend
Call SetDro (2, PlateThickness)
Code "G4 P0.5" 'Pause for Dro to update.
Code "G0 Z0.25" 'Change the Z retract height here
Code "(Z axis is now zeroed)"
Code "F" &CurrentFeed
Else
Code "(Z-Plate is grounded, check connection and try again)"
End If
End If
End If
Play with it a little before you try to use it. Try it in the air and make sure the moves are right.
Brett