281
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
'simple Z-probe
GageH = 20 'enter the gauge height here
FeedCurrent = GetOemDRO(818) 'Get the current settings
ZNew = GetOemDro(802) - 30 'probe down 30mm
Code "G31 Z" &ZNew & " F10" 'do the probing with 10mm/s
While IsMoving()
Wend
Call SetDro (2,GageH)
Code "G91 G0 Z10"
Code "G90"
Code "F" &FeedCurrent 'restore starting
'CINCINNATI-750 MACH3 CNC SOFTWARE RETROFIT
'------------------------------------------------------------------------------------------------------------
Dim acttool As Integer
Dim newtool As Integer
Dim Slot As Integer 'Slot is OEMDRO(1220) this will keep position of carousel
Dim HomeSensor As Integer
Dim Count As Integer
Const MaxTool = 24 'MaxTool number
'------------------------------------------------------------------------------------------------------------
Sub Main()
Slot=GetOEMDro(1220)
HomeSensor=(GetOEMTRIG10)
Count=(GetOEMTRIG11)
'let's do some basic check's
'Get the new ATC Pos
newtool = GetSelectedTool() ' get the newtool
acttool = GetCurrentTool() ' get the acttool
Message "New ATC Position = " &newtool
Sleep(200)
' new and acttool = 0
If ((newtool = 0) and (acttool = 0)) Then
DoButton(1003)
message("new and old tool = 0 -> abort toolchange !")
Sleep(500)
Exit Sub
End If
' new and acttool are the same
If newtool = acttool Then
message("acttool and newtool are the same -> do nothing!")
Sleep(500)
Exit Sub
End If
'check toolnumber in range
If (((newtool > MaxTool) Or (newtool < 1)) And (newtool <> 0)) Then
DoButton(1003)
Message (" toolnumber " & newtool & " is not in range (1-" &MaxTool &"). abort toolchange ! ")
MsgBox (" toolnumber " & newtool & " is not in range (1-" &MaxTool &"). abort toolchange ! ")
Exit Sub
End If
TIS1=GETOEMDRO(1201) 'TOOL IN SLOT
TIS2=GetOemDro(1202)
TIS3=GetOemDro(1203)
TIS4=GetOemDro(1204)
TIS5=GetOemDro(1205)
TIS6=GetOemDro(1206)
TIS7=GetOemDro(1207)
TIS8=GetOemDro(1208)
TIS9=GetOemDro(1209)
TIS10=GetOemDro(1210)
TIS11=GetOemDro(1211)
TIS12=GetOemDro(1212)
TIS13=GetOemDro(1213)
TIS14=GetOemDro(1214)
TIS15=GetOemDro(1215)
TIS16=GetOemDro(1216)
TIS17=GetOemDro(1217)
TIS18=GetOemDro(1218)
TIS19=GetOemDro(1219)
TIS20=GetOemDro(1230)
TIS21=GetOemDro(1231)
TIS22=GetOemDro(1232)
TIS23=GetOemDro(1233)
TIS24=GetOemDro(1234)
If NewTool=TIS1 Or NewTool=TIS2 Or NewTool=TIS3 Or NewTool=TIS4 Or NewTool=TIS5 Or NewTool=TIS6 _
Or NewTool=TIS7 Or NewTool=TIS8 Or NewTool=TIS9 Or NewTool=TIS10 Or NewTool=TIS11 Or NewTool=TIS12 _
Or NewTool=TIS13 Or NewTool=TIS14 Or NewTool=TIS15 Or NewTool=TIS16 Or Newtool=TIS17 Or NewTool=TIS18 _
Or NewTool=TIS19 Or NewTool=TIS20 Or NewTool=TIS21 Or NewTool=TIS22 Or NewTool=TIS23 Or NewTool=TIS24 Then
CODE "M19"
GoToSafeZ()
While IsMoving
Wend
Message "TOOL IN CAROUSEL"
'only unload tool
If newtool = 0 Then
'turn carousel if not in Position
If newtool <> Slot Then
LeastTravel(newtool)
SetOEMDro(1220,newtool)
End if
'now unload tool
UnloadSpindle
End If
'only load tool
If acttool = 0 Then
'turn carousel if not in Position
If acttool <> Slot Then
LeastTravel(Slot)
SetOEMDro(1220,Slot)
End if
'now load tool
LoadSpindle
End If
'full tool change
If ((acttool <> 0) And (newtool <> 0)) Then
'unload tool
'turn carousel if not in Position
If newtool <> Slot Then
LeastTravel(newtool)
SetOEMDro(1220,newtool)
End if
'now unload tool
UnloadSpindle
'load tool
'turn carousel if not in Position
If acttool <> Slot Then
LeastTravel(Slot)
SetOEMDro(1220,Slot)
End if
'now load tool
LoadSpindle
End If
SetUserDro(1224,newtool)
SetCurrentTool(newtool)
Code "G43H" & newtool
DeActivateSignal(Output17)
While IsMoving
Wend
End If
End Sub
'''''Sequence to determine the least travel to move for TC, CW or CCW
'atp = Actual tool position, rtp = Requested tool positon
Function LeastTravel(ByVal ATCPos As Integer)
NewPos = ATCPos
OldPos = GetOEMDro(1220)
NTool =24 ' Number of tools changer holds
CWPos = NewPos - OldPos ' Assume a CW move
If CWPos < 0 Then ' CWPos < 0 ==> rtp < atp
CWPos = CWPos + NTool
End If
CCWPos = NTool - CWPos
If CWPos < CCWPos Then
Call CW(CWPos)
Else
Call CCW(CCWPos)
End If
End Function
Function CW(ByVal Pos As Integer)'Rotation CW
Dim x As Integer
ActivateSignal(OUTPUT16)'UnLock Pin
While IsActive(OEMTRIG12)
Sleep (200)
Wend
ActivateSignal(OUTPUT15)'Turns Carousel CW
For x=1 To Pos
'While IsActive(OEMTRIG11)
Sleep(500)
'Wend
While IsActive(OEMTRIG11)
'Sleep(10)
Wend
Next x
CTPos=x
DeactivateSignal(OUTPUT16)
Deactivatesignal(OUTPUT15)
SetCurrenttool(NewTool)
SetUserDro(1220,NewTool)
End Function
Function CCW(ByVal Pos as Integer)'Rotation CCW
Dim y As Integer
ActivateSignal(Output16)'UnLock Pin
While IsActive (OEMTRIG12)
Sleep (200)
Wend
Activatesignal(OUTPUT14)'Turn Carousel CCW
For y=1 To Pos
'While IsActive(OEMTRIG11)
Sleep(500)
'Wend
While IsActive(OEMTRIG11)
'Sleep(10)
Wend
Next y
CTPos=y
DeactivateSignal(OUTPUT16)
Deactivatesignal(OUTPUT14)
SetCurrentTool(NewTool)
SetUserDro(1220,NewTool)
'SetUserDro(1224,NewTool)
End Function
Sub LoadSpindle()
ActivateSignal(Output9)
While IsActive(OEMTRIG3)=0
Sleep (300)
Wend
ActivateSignal(Output10)
While IsActive(OEMTRIG5)=0
Sleep (300)
Wend
ActivateSignal(Output13)
While IsActive(OEMTRIG9)=0
Sleep (300)
Wend
Code "M7"
ActivateSignal(Output11)
While IsActive(OEMTRIG7)=0
Sleep (300)
Wend
DeActivateSignal(Output10)
While IsActive(OEMTRIG4)=0
Sleep (500)
Wend
Code "M9"
DeActivateSignal(Output11)
While IsActive(OEMTRIG6)=0
Sleep (500)
Wend
DeActivateSignal(Output9)
While IsActive(OEMTRIG3) = 1
Sleep (2000)
Wend
DeActivateSignal(Output13)
Sleep (1000)
ActivateSignal(Output12)
While IsActive(OEMTRIG8)=0
Wend
DeActivateSignal(Output12)
Message "Spindle loaded"
Sleep(200)
End Sub
Sub UnloadSpindle()
ActivateSignal (Output13)'move tool arm to spindle on
While IsActive (OEMTRIG9)=0
Sleep (300)
Wend
DeActivateSignal (Output13)'move tool arm to spindle off
ActivateSignal (Output9)'extend tool arm
While IsActive (OEMTRIG3)=0
Sleep (300)
Wend
ActivateSignal (Output11)'PBD unlock
While IsActive (OEMTRIG7)=0
Sleep (300)
Wend
Code "M7"
ActivateSignal (Output10)'tool arm down
While IsActive (OEMTRIG5)=0
Sleep (300)
Wend
ActivateSignal (Output12)'move tool arm to carousel on
While IsActive (OEMTRIG8)=0
Sleep (300)
Wend
Code "M9"
DeActivateSignal (Output10)'tool arm up
While IsActive (OEMTRIG4)=0
Sleep (1000)
Wend
DeActivatesignal (Output9)'tool arm retract
DeActivateSignal (Output12)'move tool arm to carousel off
DeActivateSignal (Output11)'PBD lock
Message "Spindle Is Empty"
Sleep(200)
End Sub