Mach3 toolchange

Alle vragen die betrekking hebben over Mach cnc controllers

Moderator: Moderators

Plaats reactie
Gebruikersavatar
Swets
Berichten: 2662
Lid geworden op: 09 feb 2007 21:49
Locatie: krimpen aan den IJssel
Contacteer:

Mach3 toolchange

Bericht door Swets »

Via facebook zit ik met een of andere fransman, hij heeft een machine met een toolchange verhaal, maar dat werkt niet meer goed...

hij heeft ergens meerdere frezen staan, buiten zijn werk gebied.... de machine moet eerst de oude frees ergens weg zetten, en dan de nieuwe halen...
maar de posities komen niet meer uit....

volgens hem heeft het nooit gewerkt....

maar heeft iemand wel eens zo verhaal ge configureert?
welke macro's?
waar staan die posities?

https://www.facebook.com/groups/1559020 ... nt_mention
http://www.arjan-swets.com (met cnc filmpjes)
Gebruikersavatar
rsemotion
Berichten: 742
Lid geworden op: 02 feb 2007 20:41
Locatie: Regio Alkmaar

Re: Mach3 toolchange

Bericht door rsemotion »

dat kan je zelf aanmaken.

hangt een beetje van de mach3 versie af of sommige commandos nog werken of niet.
meestal wordt er een m6 script gemaakt waar alles in staat.

ook wordt er wel een extra DRO scherm gemaakt om informatie op te vragen.

hier iets wat ik een hele tijd terug al eens gevonden heb...

Screens
First we need to place a new user-defined DRO "1212" on one of the screens. It holds the OLD TOOL. This can be done with the mach3screen.exe screen- editor.
It is assigned at the end of the last M6End.m1s macro.
Code
M6Start.m1s
'M6 start macro with auto tool touch off

'M6Start.m1s
'Check all axes referenced
If (GetOemLed(807) Or GetOemLed(808) Or GetOemLed(809)) Then
Message(" Please Home Machine before Tool Change")

'Cycle Stop
' Button 3 - select Toolpath screen
DoButton(3)

Exit Sub
End If


'--------------- CONFIGURATION

' the X+y+z position of tool #0 is stored in DRO 1200, 1201, 1202
' THESE USER-DEFINED DROS MUST BE DEFINED IN THE SCREEN SET
' distance of tools inside the magazine along the Y axis
TOOLDISTANCE = 33.5
TOOLDISTANCE_Z = (33.5-36.5)/5
TOOLCHANGE_FEEDRATE = 150

' safe absolute Z position
SafeZ = 0
SafeX = 65

' position of the tool height sensor (magazine must be open)
THS_POS_X = 0
THS_POS_Y = 0
THS_POS_Z = 0
THS_PROBE_FEEDRATE = 5

' Thickness of touch plate in the offset-screen
PlateThickness = GetOEMDRO(1001)


'--------------- CURRENT PARAMETERS TO RESTORE

' Save the current feedrate.
CurrentFeed = GetOemDRO(818)

' Save current coordinate mode to restore it later
oldCoordinateMode = GetOemLED(48)

' Set absolute coordinate mode and feedrate
Code "G90 F" & TOOLCHANGE_FEEDRATE

' Save the current position
' WARNING, THESE DROS ARE DEPRECATED SINCE MACH3 1.90
CurrentPosX = GetDro(0)
CurrentPosY = GetDro(1)
CurrentPosZ = GetDro(2)




'--------------- TOOL CHANGE

tool = GetselectedTool()
oldTool = GetCurrentTool() 'GetOEMDRO(1212)
If oldTool = tool Then
Answer = MsgBox("old tool and new tool are identical", 0 + 16 )
Exit Sub
End If

Answer = MsgBox("experimental tool change from tool " & oldTool & " to new tool " & tool, 0)


DoSpinStop()

' use the user LED to store the state of coolant,
' so it can be restored in M6end.m1s
If getoemled(13) Then
'OEM LED 13 = "Flood LED" thus coolant is on
' set user led on
setuserled(1000,1)
Code "M9"
Else
'coolent is off
' set user led off
setuserled(1000, 0)
End If

'Get the tool change pos from the settings page
ChangeX = 24 '=GetOEMDRO(1200)
ChangeYold = 35 + (oldTool * TOOLDISTANCE) '=GetOEMDRO(1201) + (oldTool * TOOLDISTANCE)
ChangeYnew = 35 + (Tool * TOOLDISTANCE) '=GetOEMDRO(1201) + (tool * TOOLDISTANCE)
ChangeZold = -33 + (oldTool * TOOLDISTANCE_Z) '=GetOEMDRO(1202)
ChangeZnew = -33 + (Tool * TOOLDISTANCE_Z)

While IsMoving ()
Wend

'===== DEBUG====
Response = MsgBox ( "moving to Zsafe=" & SafeZ & " quickly", 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====

' G53 = Move in absolute machine coordinate system
Code("G00 G53 Z" & SafeZ)
While IsMoving ()
Wend

' open magazine
ActivateSignal(OUTPUT2)


If CurrentPosX < SafeX Then
'===== DEBUG====
Response = MsgBox ( "We are above the tool magazine, moving to SafeX=" & SafeX & " quickly" , 1 )
If Response = 2 Then ' Cancel pressed
Response = MsgBox ( "Aborting" , 1 + 16 )
End
End If
'===== DEBUG====


' go to old tool position in Y
Code("G00 G53 X" & Safex)
While IsMoving ()
Wend

'===== DEBUG====
Response = MsgBox ( "moving to y_oldtool=" & ChangeYold & " quickly", 1 )
If Response = 2 Then ' Cancel pressed
Response = MsgBox ( "Aborting" , 1 + 16 )
End
End If
'===== DEBUG====


' go to old tool position in Y
Code("G00 G53 Y" & ChangeYold)
While IsMoving ()
Wend


Else
'===== DEBUG====
Response = MsgBox ( "moving to y_oldtool=" & ChangeYold & " quickly", 1 )
If Response = 2 Then ' Cancel pressed
Response = MsgBox ( "Aborting" , 1 + 16 )
End
End If
'===== DEBUG====


' go to old tool position in Y
Code("G00 G53 Y" & ChangeYold)
While IsMoving ()
Wend

'===== DEBUG====
Response = MsgBox ( "moving to SafeX=" & SafeX & " quickly", 1 )
If Response = 2 Then ' Cancel pressed
Response = MsgBox ( "Aborting" , 1 + 16 )
End
End If
'===== DEBUG====


' go to old tool position in X
Code("G00 G53 X" & Safex)
While IsMoving ()
Wend


End If


'===== DEBUG====
Response = MsgBox ( "Moving down to ChangeZold=" & ChangeZold & " quickly" , 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====


' go to old tool position in Z
Code("G00 G53 Z" & ChangeZold)
While IsMoving ()
Wend



'===== DEBUG====
Response = MsgBox ( "Placing tool in X=" & ChangeX & " slowly" , 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====


' go to old tool position in X
Code("G01 G53 X" & ChangeX & " F" & TOOLCHANGE_FEEDRATE)
While IsMoving ()
Wend

'===== DEBUG====
Response = MsgBox ( "releasing the old tool" , 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====


' release the old tool
ActivateSignal(OUTPUT1)

'===== DEBUG====
Response = MsgBox ( "moving up to SafeZ slowly" , 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====

' move up
Code("G01 G53 Z" & SafeZ & " F" & TOOLCHANGE_FEEDRATE)
While IsMoving ()
Wend


'===== DEBUG====
Response = MsgBox ( "moving over to y=" & ChangeYnew & " quick", 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====


' go to old tool position in Y
Code("G00 G53 Y" & ChangeYnew)
While IsMoving ()
Wend

'===== DEBUG====
Response = MsgBox ( "lowering to Znew" & ChangeZnew & " slowly", 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====

' move up
Code("G01 G53 Z" & ChangeZnew & " F" & TOOLCHANGE_FEEDRATE)
While IsMoving ()
Wend

'===== DEBUG====
Response = MsgBox ( "grabbing the new tool" , 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====


' release the old tool
DeActivateSignal(OUTPUT1)


'===== DEBUG====
Response = MsgBox ( "moving to SafeX=" & SafeX & " slowly", 1 )
If Response = 2 Then ' Cancel pressed
End
End If
'===== DEBUG====


' carry the tool out
Code("G01 G53 X" & SafeX & " F" & TOOLCHANGE_FEEDRATE)
While IsMoving ()
Wend



'--------------- TOOL HEIGHT PROBE
Response = MsgBox ( "Would you like to set your Z height automatically? If so, click OK", 1 )
If Response = 1 Then
' TODO THIS HAS NOT BEEN TESTED YET


' go to tool height sensor position
Code "G00 G53 X" & THS_POS_X & "Y" & THS_POS_Y
While IsMoving ()
Wend

While GetOemLed (825)=0
Message ("(Z-Plate is grounded, check connection and dismiss this dialog)")
Wend

Code "G31 Z-5 F" & THS_PROBE_FEEDRATE
While IsMoving()
Wend

'dwell for 0.25 seconds
Sleep(250)

ZProbePos = GetVar(2002)

'Go back to touch position (G31 backs off after touch)
Code "G0 Z" & ZProbePos
While IsMoving ()
Wend

'Set Z axis position DRO to touch plate thickness
' WARNING, THIS DRO IS DEPRECATED SINCE MACH3 1.90
Call SetDro (2, PlateThickness)

'Pause 0.5 seconds for Dro to update.
Sleep(500)

' go up again
Code "G00 G53 Z" & SafeZ
While IsMoving ()
Wend

Code "(Z axis is now zeroed)"
' restore the original feedrate
Code "F" & CurrentFeed
End If

SetCurrentTool( tool )

' close magazine
DeActivateSignal(OUTPUT1)


'--------------- RESTORE ORIGINAL PARAMETERS

' Reset coordinate mode to original value
If AbsMode = 0 Then
Code("G91")
End If

'===== DEBUG====
'Response = MsgBox ( "moving to back to " & CurrentPosX & " - " & CurrentPosY &" , then Z=" & CurrentPosZ , 1 )
'If Response = 0 Then ' Cancel pressed
' End
'End If
'===== DEBUG====

' go to old tool position
'Code("G00 G53 X" & CurrentPosX & "Y" & CurrentPosY)
'While IsMoving ()
'Wend
' go to old tool position
'Code("G00 G53 Z" & CurrentPosZ)
'While IsMoving ()
'Wend


' Reset feedrate to original value
Code("F" & CurrentFeed)

M6End.m1s

'M6End.m1s
tool = GetDRO(24)
oldTool = GetOEMDRO(1212)

' check user led
If getuserled(1000) Then
'coolant was on
Code "M8"
End If

If (oldTool <> tool) Then
SetOEMDRO(1212, tool)
End If
Ook een konijn kan wel eens het haasje zijn...
Plaats reactie