Hello Guest it is March 29, 2024, 05:59:11 AM

Author Topic: Tool changer macro help  (Read 11104 times)

0 Members and 1 Guest are viewing this topic.

Tool changer macro help
« on: April 08, 2007, 01:01:21 AM »
Hi All
 I can't seem to get Mach3 2.00.061 to wait for my plc to change the tool when the config screen is set to automatic tool changer. It works fine if I set it to stop spindle and wait but I have to be there to push the cycle start after each tool change is complete. Any help would be much appreciated, Here is my m6start.m1s macro.



Num_Positions = 16
Code ("G53 g0 z0")
While IsMoving()
Wend
'SystemWaitfor ( INPUT4 )'toolchange complete signal
OldTool = GetOemDRO (1200) 'Tool In spindle DRO
While OldTool > Num_Positions Or OldTool <= 0     ' Check for a valid tool   
OldTool = Question ("Invalid Tool , Current Tool Number?")   
Wend
tool = GetSelectedTool() 
While Tool > Num_Positions Or Tool <= 0 ' Check for a valid tool   
Tool = Question ("Invalid Tool Requested, New Tool Number?")   
Wend   
NewTool = Tool
If NewTool = OldTool Then
   Exit Sub
End if
ToolDif1 = NewTool - OldTool 
ToolDif2 = OldTool - NewTool
If ToolDif1 < ToolDif2 Then
CarMove = ToolDif2
ActivateSignal( 8 )           'set carrosel to turn cw
Else
CarMove = ToolDif1
DeActivateSignal( 8 )         'set carrosel to turn ccw
End If
setmodoutput ( 64 , CarMove ) ' set plc counter to rotate number of positions
ActivateSignal( 9 )           ' activate toolchange
While IsActive (20)           ' wait for counter
Wend
DeActivateSignal( 9 )         ' insert tool and retract
Call SetUserDRO (1200,NewTool) 


Thanks
Steve
SKFab             
 

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Tool changer macro help
« Reply #1 on: April 08, 2007, 09:33:05 AM »
You need to put your "SystemWait()" at the END of your Macro, in where your PLC can send a "tool change done bit" to you input 4
fun times
Re: Tool changer macro help
« Reply #2 on: April 08, 2007, 01:23:01 PM »
Thanks I will give that a try later today. MY tool change bit is only on about .5 second after the tool change is this ok?
Re: Tool changer macro help
« Reply #3 on: April 09, 2007, 01:08:25 AM »
I got it to work by putting a pause after the (g53 g0 z0) that let the plc engage and lockout the input1. I could not get SystemWaitFor ( INPUT4 ) to let the system go even with the input signal working. Is there additional code that goes with systemwaitfor ()  that makes it work?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Tool changer macro help
« Reply #4 on: April 09, 2007, 11:27:05 PM »
Swap you active hi/low setting on imput4 and see if you see it then, when input 4 is active, and see if systemwait drops out.
fun times
Re: Tool changer macro help
« Reply #5 on: June 18, 2023, 11:13:33 AM »
Eu copiei e colei este código no meu M6Start.m1s dentro da pasta de MAcros do MAch3, mas não funcionoum simplesmente não aconteceu nada existe algum codigo pronto que eu possa usar nao entendo nada de programação .

'Macro ToolChange Para trocador de ferramentas tipo cama
Sub Main()
OldTool = GetOEMDRO (1200) 'Ferramenta no fuso DRO Você deve adicionar isso à sua tela de configurações
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
tool = GetSelectedTool()
NewTool = ferramenta
'Macro do trocador de ferramentas (tipo de leito)
MaxToolNum = 8 'Número máximo de ferramentas para o trocador
ToolDown = -4 'Z Pos para obter ou soltar uma ferramenta
ToolUp = 0,0 'Z Hieght to Rapid de ferramenta para ferramenta
If NewTool = OldTool Then
   Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Digite o número da nova ferramenta até " & MaxToolNum)
Wend
Code "G00 G53 Z" & ToolUp
While IsMoving()
Wend
Call MovePos(OldTool)
While IsMoving()
Wend
Code "G53 Z " & ToolDown
Code "G4 P.75"
While IsMoving()
Wend
ActivateSignal(Output1) 'Ativa a barra Draw para liberar a ferramenta
Code "G4 P1.0" 'Esperar a liberação da ferramenta
'SystemWaitFor (7) 'Esperar a liberação da ferramenta Interruptor de limite
Código "G53 Z-2.5" & ToolUp
Chamar MovePos(NewTool)
While IsMoving()
Wend
Code "G53 Z " & ToolDown
Code "G4 P.75"
While IsMoving()
Wend
DeActivateSignal(Output1) 'Desligue a barra de tração para prender a ferramenta
Code "G4 P1.0" 'Espere a ferramenta prender
enquanto IsMoving()
Wend
Code "G53 Z" & ToolUp
Chamada SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
Código "G00 X" & x & " Y" & y 'Volte para onde a troca de ferramenta foi solicitada
End Sub

Sub MovePos(ByVal ToolNumber As Integer)

Selecione Case ToolNumber
       Caso Is = 1
         Xpos = 3,568
         YPos = 112,219
       Caso Is = 2
         Xpos = 9,812
         YPos = 112,219
       Caso Is = 3
         Xpos = 15,969
         YPos = 112,219
       Caso Is = 4
         Xpos = 22,308
         YPos = 112,219
       Caso Is = 5
         Xpos = 28 0,559
         YPos = 112,219
       Case Is = 6
         Xpos = 34.881
         YPos = 112.219
       Case Is = 7
         Xpos = 41.076
         YPos = 112.219
       Case Is = 8
         Xpos = 47.289
         YPos = 112.219
End Select

Código "G53 X" & XPos & " Y" & YPos
End Sub
Main