Ottimo lavoro bravi
Anche io ho iniziato questa avventura ...Ho trovato degli spunti e ho ottimizzato una macro che funziona ma sto trovando difficoltà nell' implementare il controllo dei due sensori del mandrino
.
la macro è questa:
-------------------------------------------------------------------------------------------------------------------------------------------------
Sub Main()
OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
tool = GetSelectedTool()
NewTool = tool
'----------------Tool Changer Macro (Bed Type)----------------------
MaxToolNum = 6 'Max number off tools for the changer
ToolDown = -150 'Z Pos to Get or drop a tool
ToolUp = 0 'Z Hieght to Rapid from tool to tool
'--------------------Auto Tool Zero---------------------------------
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
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
'-------------------------------------------------------------------
If NewTool = OldTool Then
Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
Code "G00 G53 Z " & ToolUp
While IsMoving()
Wend
Call MovePos(OldTool)
While IsMoving()
Wend
Code "G4 P1"
Code "G53 Z" & ToolDown
While IsMoving()
Wend
ActivateSignal(Output4) 'Turn On Draw bar to release the tool
Code "G4 P2.0" 'Wait for the tool to release
'SystemWaitFor (7) 'Wait for the tool Release Limit switch
Code "G53 Z-0.5" & ToolUp
Call MovePos(NewTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown
Code "G4 P1"
While IsMoving()
Wend
DeActivateSignal(Output4) 'Turn Off Draw bar to Clamp the tool
Code "G4 P2.0" 'Wait for the tool to Clamp
While IsMoving()
Wend
Code "G53 Z" & ToolUp
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
While IsMoving()
Wend
ActivateSignal(Output5) 'Clamp the tool
Code "G4 P5.0" 'Wait for the tool to Clamp
While IsMoving()
Wend
DeActivateSignal(OUTPUT5)
'-----------------------------Auto Tool Zero-----------------------------
Code "G53 X100 Y100" ' Move to Probe position
Code "G4 P1" ' this delay gives me time to get from computer to hold probe in place
Code "G31Z-50 F150" '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 Z30." 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "G00 X" & x & " Y" & y 'Move back to where the tool change was prompted
End Sub
'---------------------------Tool Positio-------------------------------------
Sub MovePos(ByVal ToolNumber As Integer)
Select Case ToolNumber
Case Is = 1
Xpos = 100.00
YPos = 20.00
Case Is = 2
Xpos = 170.00
YPos = 20.00
Case Is = 3
Xpos = 240.00
YPos = 20.00
Case Is = 4
Xpos = 310.00
YPos = 20.00
Case Is = 5
Xpos = 380.00
YPos = 20.00
Case Is = 6
Xpos = 450.00
YPos = 20.00
End Select
Code "G53 X" & XPos & " Y" & YPos
End Sub
Main
-----------------------------------------------------------------------------------------------------------------------------------------------
I sensori li ho collegati ad imput1 e imput 2 rispettivamente oem 821 e 822
la logica è
imput 1 = 1
Cono agganciato
imput 2 = 0
imput 1 = 0
Pinza Aperta
imput 2 = 1
imput 1 = 0
Cono non agganciato o scarico
imput 2 = 0
Vorrei che se non aggancia per errore il cono, appaia un messaggio di errore "CONO NON AGGANCIATO" e la lavorazione si fermasse, e magari fare in modo di ritentare l'aggancio dando uno start... ma dopo vari tentativi non ne vengo fuori
Mi date una mano...
Altra cosa che non ho capito ma questo sarebbe un pulsante da aggiungere o un'altra pagina?
OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen