Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: javiele66 on October 18, 2018, 01:02:24 PM

Title: tool changer
Post by: javiele66 on October 18, 2018, 01:02:24 PM
Good morning, I just bought a cnc router.
To have the problem is that I want you to make some trajectories with a milling tool first and then change tool automatically and make a 2 path.
Well then after doing the design in aspire postprocess with mach3 / atc. I send it to the CNC and it makes the first trajectories, then it goes and changes the tool and returns to part 0 to start its second trajectories, but at that point it again changes tools and enters a tool change loop, specifically Go back to line 14, can someone tell me what I'm doing wrong?
I have tried to postprocess independent files (copy and paste), I would greatly appreciate your help, I leave you the code generated by vectric aspire., Greetings.

( cambioher )
( File created: Wednesday October 10 2018 - 06:14 PM)
( for Mach2/3 from Vectric )
( Material Size)
( X= 300.000, Y= 300.000 ,Z= 10.000)
()
(Toolpaths used in this file:)
(Perfilado 1)
(Perfilado 2)
(Tools used in this file: )
(3 = aluminio)
(4 = aluminio2)
N120G00G21G17G90G40G49G80
N130G71G91.1
N140T3M06
N150 (aluminio)
N160G00G43Z20.320H3
N170S10000M03
N180(Toolpath:- Perfilado 1)
N190()
N200G94
N210X0.000Y0.000F3600.0
N220G00X48.846Y163.982Z5.080
N230G1X48.846Y163.982Z-3.000F600.0
N240G1X128.846Y163.982Z-3.000F3600.0
N250G1X128.846Y233.982Z-3.000
N260G1X48.846Y233.982Z-3.000
N270G1X48.846Y163.982Z-3.000
N280G00X48.846Y163.982Z5.080
N290T4M6
N300 (aluminio2)
N310G43H4
N320S10000M03
(Perfilado 2)
()
N350G00X88.846Y229.434Z5.080
N360G1X88.846Y229.434Z-3.000F600.0
N370G3X58.394Y198.982I0.000J-30.452F3600.0
N380G3X88.846Y168.530I30.452J0.000
N390G3X119.298Y198.982I0.000J30.452
N400G3X88.846Y229.434I-30.452J0.000
N410G00X88.846Y229.434Z5.080
N420G00Z20.320
N430G00X0.000Y0.000
N440M09
N450M30
%

PD: I do the simulation in match3 and without problem, but when you do it physically, you do the things described above.
Also say that the machine with command t6 changes tool without problem, it is only when I execute a code g.
Title: Re: tool changer
Post by: TPS on October 19, 2018, 02:14:54 AM
can you please post your m6 macro?
Title: Re: tool changer
Post by: javiele66 on October 19, 2018, 05:02:07 AM
attached macro m6, thanks.
Title: Re: tool changer
Post by: TPS on October 21, 2018, 01:08:33 PM
i have run your g-code and M6 Conde on my PP testmachine without any Problem.

can you describe the exact line whre the Loop starts ?
Title: Re: tool changer
Post by: javiele66 on October 22, 2018, 05:39:55 AM
helllo, On line 33, and return to line 14, thank you
Title: Re: tool changer
Post by: javiele66 on October 26, 2018, 10:22:41 AM
hello, can somebody help me? thank you.
Title: Re: tool changer
Post by: TPS on October 27, 2018, 03:35:48 AM
sorry for the Long delay, was too busy this week.

so it is going from

N310G43H4


to

N130G71G91.1


right? that makes no sense for me.
Title: Re: tool changer
Post by: javiele66 on October 27, 2018, 05:30:31 AM
hello, I understand that it does not make sense, but it is what the machine does, I do not know why, take the second tool and go to part 0 and again take the first tool again and make the first drawing and so an infinite loop, thank you.
Title: Re: tool changer
Post by: TPS on October 27, 2018, 08:04:41 AM
so you can only try and error

use the line

N130G71G91.1 without the G71

because there is allready a G21 in the line before:

N120G00G21G17G90G40G49G80

i am only trying to guess, without a real idea, why it is doing this.

btw. witch Controller are you using?
Title: Re: tool changer
Post by: javiele66 on October 27, 2018, 10:26:49 AM
hello, attached photo of the controller, thank you.
Title: Re: tool changer
Post by: TPS on October 27, 2018, 12:39:02 PM
oh jeah, we are on the chinese Controller road  :o :o

as sayed in a Prior reply, i have tested your code on my PP machine without any Problem.
have you buyed this machine/controller from China?

any Support avaliable?

Title: Re: tool changer
Post by: TPS on October 28, 2018, 03:14:28 AM
made som minor changes on your M6 macro, lets see, maybe it helps

Code: [Select]
'********************************************************************************
'*                   MACRO - CAMBIO DE HERRAMIENTA AUTOMATICO                   *
'********************************************************************************                 
'*      Version: 1.1                                                            *
'* Fecha inicio: 26/07/2015                                                     *
'* Fecha modif.: 25/08/2015                                                     *
'*     Objetivo: Realizar el cambio de herramienta automatico en Mach3          *
'*      Fichero: M6start.ms1                                                    *
'********************************************************************************
'*                                                                              *
'* Drescripción:                                                                *
'*                                                                              *
'* 1. Se mueve el eje Z a cero                                             *
'* 2. Se mueve el eje Y a posición segura                                  *
'* 3. Espera a que se pare el mandrino                                     *
'* 4. Se mueve el eje X para soltar herramienta                            *
'* 5. Se mueve el eje Z a posición de intercambio                          *
'* 6. Se mueve el eje Y para encastrar herramienta                         *
'* 7. Activar el cambio de herramienta                                     *
'* 8. Espera a que Mandrino suelta la Herramienta                          *
'* 9. Se mueve el eje Z a cero                                             *
'* 10. Se mueve el eje X e Y a coordenadas nueva Herramienta               *
'* 11. Se mueve el eje Z a posicion de intercambio                         *
'* 12. Desactivar el cambio de herramienta                                 *
'* 13. Espera a que Mandrino coja la herramienta                           *
'* 14. Se mueve el eje Y para descastrar herramienta                       *
'* 15. Se mueve el eje Z a cero                                            *
'* 16. Se mueve el eje X, Y a punto de partida                             *
'*                                                                         *
'********************************************************************************


Sub Main()
'Call SetUserDRO (1200,0)
' Inicialización del temporizador para el cambio de herramienta
'SetTimer(1)
'---------- Mensaje de inicio ---------------------------------------------------
Message "<< Iniciado el cambio de herramienta ..." 'Pone este mensaje en la barra de estado

'---------- Declaravión de Variables --------------------------------------------
MaxToolNum = 5 'Numero máximo de herramientas en el cambiador
ToolUp = -10 'Posición de Z segura arriba
ToolDw = -287.54 'Posición de Z para coger o dejar una herramienta
ToolSf = 90 'Posición de Y segura para extraer o insertar herramienta

'---------- Recoger Información de la herramienta actual ------------------------
ToolOld = GetOEMDRO (1200) 'Tomar el valor de la herramienta actual
x = GetToolChangeStart( 0 ) 'Tomar la posición de X actual
y = GetToolChangeStart( 1 ) 'Tomar la posición de Y actual
z = GetToolChangeStart( 2 ) 'Tomar la posición de Z actual

'---------- Recoger Información de la nueva Herramienta -------------------------
ToolNew = GetSelectedTool() 'Tomar el valor de la nueva herramienta
While ToolNew < 1 Or ToolNew > MaxToolNum 'Si el numero de la herramienta es superior
   'El operador deberá introducir un valor desde la pantalla
   ToolNew = Question ("Introduzca un numero de herramienta válido (1..." & MaxToolNum & ")")
Wend
If ToolNew = ToolOld Then 'Si la nueva herramienta es igual a la existente
   Exit Sub 'Salimos de la subrutina
End If
Message "<< Cambio de " & ToolOld & ",por " & ToolNew

'---------- Movimientos hacia el intercambiador ---------------------------------
'DoSpinStop() ' Parar mandrino
Message "<< Moviendo eje Z a cero ...." 'Pone este mensaje en la barra de estado
Code "G00 G53 Z" & ToolUp 'Subir el eje Z a cero
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "Moviendo eje Y a posicion segura ..." 'Pone este mensaje en la barra de estado
Code "G53 Y10 X10" 'Desplaza eje Y a posición segura.
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
' Realiza un Home
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

Code "G53 Y" & ToolSf 'Desplaza eje Y a posición segura.
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend

'---------- Espera hasta que el mandrino se pare --------------------------------
Message "<< Espera a que el mandrico se pare ..." 'Pone este mensaje en la barra de estado
'While GetOEMDRO(99) <> 0 'Esperar a que el mandrino se pare
'Wend
Message "<< Mandrino parado ..." 'Pone este mensaje en la barra de estado

'---------- Movimientos para soltar herramienta actual --------------------------
Message "<< Posicionando para soltar herramienta ..." 'Pone este mensaje en la barra de estado
Call MovePos(ToolOld,"X") 'Mover primero eje X a la posición herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G53 Z" & ToolDw 'Mover el eje Z a la altura de cambio
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Call MovePos(ToolOld,"Y") 'Mover eje Y a la posición soltar herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Posicionado completado ..." 'Pone este mensaje en la barra de estado

'---------- Soltar herramienta actual -------------------------------------------
Message "<< Accionando Change Tool ..." 'Pone este mensaje en la barra de estado
Code "G4 P.25" 'Esperar un pequeño tiempo
ActivateSignal(Output6) 'Activar la salida para soltar herramienta
'Esperar a el sistema neumatico del mandrino indique herramienta liberada
'SetTimer(2)
CTime = 0 'Inicializa el Temporizador
While Not(IsActive(input1) And Not IsActive(input2) And IsActive(input3))
'CTime = GetTimer(2)
CTime = CTime + 1
If CTime > 1000000 Then
Ret = MachMsg("No se ha podido SOLTAR la Herramienta.... Por Favor revise el Circuito neumático del mandrino....", _
"Tool Change Warning", 5)
If Ret = 2 Then
'MachMsg("Cambio de Herramienta Cancelado....", "Tool Change", 0)
Message "<< Cambio de Herramienta Cancelado" 'Pone este mensaje en la barra de estado
Exit Sub
Else
'SetTimer(2) 'Inicializa el Temporizador
CTime = 0
End If
End If
Wend
Code "G4 P1.0" 'Esperar un pequeño tiempo
Message "<< Herramienta Soltada ..." 'Pone este mensaje en la barra de estado

'---------- Movimientos para coger nueva herramienta ----------------------------
Message "<< Moviendo eje Z a cero ..." 'Pone este mensaje en la barra de estado
Code "G53 Z" & ToolUp 'Subir el eje Z para alejarse de la herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Posicionado para coger nueva Herramienta ..." 'Pone este mensaje en la barra de estado
Call MovePos(ToolNew,"X") 'Mover primero eje X a la posición herramienta
Call MovePos(ToolNew,"Y") 'Mover eje Y a la posición coger herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G53 Z" & ToolDw 'Mover el Eje Z para tomar la Herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Posicionado completado ..." 'Pone este mensaje en la barra de estado

'---------- Coger nueva herramienta -------------------------------------------
Message "<< Desactivar Change Tool ..." 'Pone este mensaje en la barra de estado
Code "G4 P.25" 'Esperar un pequeño tiempo
DeActivateSignal(Output6) 'Desactivar la salida para coger la herramienta
'Esperar a el sistema neumatico del mandrino indique herramienta esta cogida
'SetTimer(2)
Ctime = 0
While Not(Not IsActive(input1) And IsActive(input2) And Not IsActive(input3))
'CTime = GetTimer(2)
CTime = CTime + 1
If CTime > 1000000 Then
Ret = MachMsg("No se ha podido COGER la Herramienta.... Por Favor revise el Circuito neumático del mandrino....", _
"Tool Change Warning", 5)
If Ret = 2 Then
'MachMsg("Cambio de Herramienta Cancelado....", "Tool Change", 0)
Message "<< Cambio de Herramienta Cancelado" 'Pone este mensaje en la barra de estado
Exit Sub
Else
'SetTimer(2) 'Inicializa el Temporizador
CTime = 0
End If
CTime = 0
End If
'Pregunta por si se ha producido un Error al coger la herramienta
If(IsActive(input1) And IsActive(input2) And Not IsActive(input3)) Then
MachMsg("Colector cerrado sin herramienta... Por favor revise el Colector del mandrino....", _
"Tool Change Warning", 0)
End If
Wend
Code "G4 P1.0" 'Esperar un pequeño tiempo
Message "<< Herramienta sujeta ..." 'Pone este mensaje en la barra de estado


'---------- Movimientos a Coordenadas Seguras ---------------------------------
Message "<< Moviendo eje Y a posición segura ..." 'Pone este mensaje en la barra de estado
Code "G53 Y" & ToolSf 'Desplaza eje Y a posición segura.
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G53 Z" & ToolUp 'Subir el Eje Z
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Moviendo eje Z a cero ..." 'Pone este mensaje en la barra de estado

'---------- Asignar Herramienta recogida en el sistema ------------------------
Call SetUserDRO (1200,ToolNew)
SetCurrentTool( ToolNew )

'---------- Auto Tool Zero ----------------------------------------------------
'Code "(Iniciado Auto Tool Zero...)" 'Pone este mensaje en la barra de estado
'Code "G0 X100 Y100" 'Mueve a la posición de Prueba
'Code "G4 P5" 'Este tiempo me da para poder colocar la sonda
'Code "G31Z-10 F100" 'El movimiento de prueba, puede cambiar la velocidad
'While IsMoving() 'Esperar a que se ejecute el movimiento
'Wend
'ZProbePos = GetVar(2002) 'Obtener el punto exacto cuando la sonda sea golpeada
'Code "G0 Z" & ZProbePos 'Volver de nuevo a ese punto,
'While IsMoving () 'Esperar a que se ejecute el movimiento
'Wend
'Call SetDro (2, PlateThickness) 'Ajustar el eje Z a lo que se establece como espesor de la placa
'Code "G4 P0.25" 'Esperar un pequeño tiempo
'Code "G0 Z" & ToolUp 'Subir el Eje Z
'Code "(Moviendo eje Z a cero)" 'Pone este mensaje en la barra de estado

'---------- Regresar al punto de partida --------------------------------------
Message "<< Regresando al punto de partida ..." 'Pone este mensaje en la barra de estado
Code "G00 X" & x & " Y" & y '& " Z" & z  'Mueve la máquina al punto de partida
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G4 P1.00" 'Esperar un pequeño tiempo
Message "<< Cambio de Herramienta realizado" 'Pone este mensaje en la barra de estado

End Sub

Sub MovePos(ByVal ToolNumber As Integer, ByVal EjeMove As String)
'Subrutina donde estan las posiciones de cada herramienta
Select Case ToolNumber     
Case Is = 1
XPos = 125
YPos = 11.2
Case Is = 2
XPos = 299
YPos = 11.2
Case Is = 3
XPos = 474
YPos = 11.2
Case Is = 4
XPos = 815
YPos = 11.2
Case Is = 5
XPos = 991
YPos = 11.2
Case Is = 0 ' Posición de herramienta no existente
XPos = 1164
YPos = 11.2

End Select
       
If EjeMove = "X" Then
Code "G00 G53 X" & XPos
End If
If EjeMove = "Y" Then
Code "G01 G53 Y" & YPos & " F1500"
End If

End Sub

Title: Re: tool changer
Post by: javiele66 on October 28, 2018, 06:28:24 AM
hello, First of all thank your help, but unfortunately remains the same, thank you.
Title: Re: tool changer
Post by: TPS on October 28, 2018, 07:16:32 AM
witch Version of Mach3 are you running?

i use .022 witch was recommended by the supplier of my Controller,
and never missed anything.
Title: Re: tool changer
Post by: javiele66 on October 28, 2018, 07:17:23 AM
Sorry TPS, I forgot to tell you that the machine is not Chinese, but brought that driver, thanks
Title: Re: tool changer
Post by: javiele66 on October 28, 2018, 07:18:46 AM
Version Mach3: R3.043.022
Title: Re: tool changer
Post by: TPS on October 28, 2018, 07:28:17 AM
here:

http://www.machsupport.com/forum/index.php/topic,28313.10.html

in Reply #15 is a simular probem described, but no solution.
Title: Re: tool changer
Post by: TPS on October 28, 2018, 07:33:34 AM
Version Mach3: R3.043.022

have you tryed a newer one ?
maybe it helps.
Title: Re: tool changer
Post by: javiele66 on October 28, 2018, 07:38:10 AM
What do you mean by a new one?
Title: Re: tool changer
Post by: TPS on October 28, 2018, 07:39:44 AM
Version R3.043.066 is the newest.

here: ftp://ftp.machsupport.com/Mach3/

are the different Versions.
Title: Re: tool changer
Post by: javiele66 on October 28, 2018, 07:41:54 AM
Ah ok you mean update
Title: Re: tool changer
Post by: javiele66 on October 28, 2018, 07:44:43 AM
Do you think it will be solved? or is it advisable to change the controller?
Title: Re: tool changer
Post by: Tweakie.CNC on October 28, 2018, 08:00:29 AM
Unfortunately, this is an issue we are seeing more and more often here on the forum – The cheap Chinese motion controller’s work but they do not fully support all the Mach3 / Mach4 functions so there will always be problems with these products.
Best advice :-  always buy a product which has the manufacturer’s full support and backup – you may pay more initially but you only need to buy once (many members have said this here on the forum “buy cheap, buy twice”).

Tweakie.
Title: Re: tool changer
Post by: TPS on October 28, 2018, 02:01:36 PM
Do you think it will be solved?

i realy don't know,but it is the cheapest way to try.

or is it advisable to change the controller?

would be the next "way" after trying the update way.
Title: Re: tool changer
Post by: TPS on October 29, 2018, 02:00:30 AM
btw. have you checked, that you are using the latest Version of the Controller plugin ?
Title: Re: tool changer
Post by: javiele66 on October 29, 2018, 08:03:41 AM
hello, excuse my ignorance I am new, how do I do it? thank you.
Title: Re: tool changer
Post by: TPS on October 29, 2018, 08:39:19 AM
first of all rename your c:\mach3 Folder to Keep all existing data

here:

https://www.nvcnc.net/xhc-cnc-controller.html

you can find the latest plugin (i think) and saome Manuals how to install a fesh mach3 instalation.

Title: Re: tool changer
Post by: javiele66 on October 29, 2018, 04:37:05 PM
hello, Well, it is already updated, but still the same, where can I look more? thank you.
Title: Re: tool changer
Post by: TPS on October 30, 2018, 02:47:04 AM
do you have any Chance to contact the supplier of your Controller ?
Title: Re: tool changer
Post by: TPS on November 01, 2018, 05:34:40 AM
another try would be to run the Programm for test in Single Step (Single BLK), to see
wether the look ahead creates this Problem.
Title: Re: tool changer
Post by: javiele66 on November 01, 2018, 03:46:03 PM

hello, I do not understand you.
Title: Re: tool changer
Post by: TPS on November 02, 2018, 03:01:57 AM
if you enable in main Screen "single BLK" you can run the GCode Line by line.

you have to press Start for every single line
Title: Re: tool changer
Post by: javiele66 on November 02, 2018, 03:03:00 PM
hello, Sorry, I did not understand, I've tried it, it's still the same, when it reaches line 34, it goes back to line 1.
Title: Re: tool changer
Post by: TPS on November 05, 2018, 01:11:54 AM
ok then it Looks like it is something Controller specific.

any Chance to contact the supplier ?
Title: Re: tool changer
Post by: javiele66 on November 05, 2018, 11:21:01 AM

hello, I do not know how to locate it, I searched for it and can not find it to contact, thanks
Title: Re: tool changer
Post by: javiele66 on November 09, 2018, 06:09:39 AM
hello, I've been looking and I've seen that the file m6end is empty is normal? thanks
Title: Re: tool changer
Post by: TPS on November 09, 2018, 07:09:05 AM
depends on, what you have selected in Config -> General Config
Title: Re: tool changer
Post by: javiele66 on November 09, 2018, 07:29:00 AM
attached image
Title: Re: tool changer
Post by: TPS on November 09, 2018, 07:31:18 AM
in this case M6End is not needed
Title: Re: tool changer
Post by: foxer_125 on December 04, 2022, 12:36:47 PM
made som minor changes on your M6 macro, lets see, maybe it helps

Code: [Select]
'********************************************************************************
'*                   MACRO - CAMBIO DE HERRAMIENTA AUTOMATICO                   *
'********************************************************************************                 
'*      Version: 1.1                                                            *
'* Fecha inicio: 26/07/2015                                                     *
'* Fecha modif.: 25/08/2015                                                     *
'*     Objetivo: Realizar el cambio de herramienta automatico en Mach3          *
'*      Fichero: M6start.ms1                                                    *
'********************************************************************************
'*                                                                              *
'* Drescripción:                                                                *
'*                                                                              *
'* 1. Se mueve el eje Z a cero                                             *
'* 2. Se mueve el eje Y a posición segura                                  *
'* 3. Espera a que se pare el mandrino                                     *
'* 4. Se mueve el eje X para soltar herramienta                            *
'* 5. Se mueve el eje Z a posición de intercambio                          *
'* 6. Se mueve el eje Y para encastrar herramienta                         *
'* 7. Activar el cambio de herramienta                                     *
'* 8. Espera a que Mandrino suelta la Herramienta                          *
'* 9. Se mueve el eje Z a cero                                             *
'* 10. Se mueve el eje X e Y a coordenadas nueva Herramienta               *
'* 11. Se mueve el eje Z a posicion de intercambio                         *
'* 12. Desactivar el cambio de herramienta                                 *
'* 13. Espera a que Mandrino coja la herramienta                           *
'* 14. Se mueve el eje Y para descastrar herramienta                       *
'* 15. Se mueve el eje Z a cero                                            *
'* 16. Se mueve el eje X, Y a punto de partida                             *
'*                                                                         *
'********************************************************************************


Sub Main()
'Call SetUserDRO (1200,0)
' Inicialización del temporizador para el cambio de herramienta
'SetTimer(1)
'---------- Mensaje de inicio ---------------------------------------------------
Message "<< Iniciado el cambio de herramienta ..." 'Pone este mensaje en la barra de estado

'---------- Declaravión de Variables --------------------------------------------
MaxToolNum = 5 'Numero máximo de herramientas en el cambiador
ToolUp = -10 'Posición de Z segura arriba
ToolDw = -287.54 'Posición de Z para coger o dejar una herramienta
ToolSf = 90 'Posición de Y segura para extraer o insertar herramienta

'---------- Recoger Información de la herramienta actual ------------------------
ToolOld = GetOEMDRO (1200) 'Tomar el valor de la herramienta actual
x = GetToolChangeStart( 0 ) 'Tomar la posición de X actual
y = GetToolChangeStart( 1 ) 'Tomar la posición de Y actual
z = GetToolChangeStart( 2 ) 'Tomar la posición de Z actual

'---------- Recoger Información de la nueva Herramienta -------------------------
ToolNew = GetSelectedTool() 'Tomar el valor de la nueva herramienta
While ToolNew < 1 Or ToolNew > MaxToolNum 'Si el numero de la herramienta es superior
   'El operador deberá introducir un valor desde la pantalla
   ToolNew = Question ("Introduzca un numero de herramienta válido (1..." & MaxToolNum & ")")
Wend
If ToolNew = ToolOld Then 'Si la nueva herramienta es igual a la existente
   Exit Sub 'Salimos de la subrutina
End If
Message "<< Cambio de " & ToolOld & ",por " & ToolNew

'---------- Movimientos hacia el intercambiador ---------------------------------
'DoSpinStop() ' Parar mandrino
Message "<< Moviendo eje Z a cero ...." 'Pone este mensaje en la barra de estado
Code "G00 G53 Z" & ToolUp 'Subir el eje Z a cero
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "Moviendo eje Y a posicion segura ..." 'Pone este mensaje en la barra de estado
Code "G53 Y10 X10" 'Desplaza eje Y a posición segura.
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
' Realiza un Home
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

Code "G53 Y" & ToolSf 'Desplaza eje Y a posición segura.
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend

'---------- Espera hasta que el mandrino se pare --------------------------------
Message "<< Espera a que el mandrico se pare ..." 'Pone este mensaje en la barra de estado
'While GetOEMDRO(99) <> 0 'Esperar a que el mandrino se pare
'Wend
Message "<< Mandrino parado ..." 'Pone este mensaje en la barra de estado

'---------- Movimientos para soltar herramienta actual --------------------------
Message "<< Posicionando para soltar herramienta ..." 'Pone este mensaje en la barra de estado
Call MovePos(ToolOld,"X") 'Mover primero eje X a la posición herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G53 Z" & ToolDw 'Mover el eje Z a la altura de cambio
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Call MovePos(ToolOld,"Y") 'Mover eje Y a la posición soltar herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Posicionado completado ..." 'Pone este mensaje en la barra de estado

'---------- Soltar herramienta actual -------------------------------------------
Message "<< Accionando Change Tool ..." 'Pone este mensaje en la barra de estado
Code "G4 P.25" 'Esperar un pequeño tiempo
ActivateSignal(Output6) 'Activar la salida para soltar herramienta
'Esperar a el sistema neumatico del mandrino indique herramienta liberada
'SetTimer(2)
CTime = 0 'Inicializa el Temporizador
While Not(IsActive(input1) And Not IsActive(input2) And IsActive(input3))
'CTime = GetTimer(2)
CTime = CTime + 1
If CTime > 1000000 Then
Ret = MachMsg("No se ha podido SOLTAR la Herramienta.... Por Favor revise el Circuito neumático del mandrino....", _
"Tool Change Warning", 5)
If Ret = 2 Then
'MachMsg("Cambio de Herramienta Cancelado....", "Tool Change", 0)
Message "<< Cambio de Herramienta Cancelado" 'Pone este mensaje en la barra de estado
Exit Sub
Else
'SetTimer(2) 'Inicializa el Temporizador
CTime = 0
End If
End If
Wend
Code "G4 P1.0" 'Esperar un pequeño tiempo
Message "<< Herramienta Soltada ..." 'Pone este mensaje en la barra de estado

'---------- Movimientos para coger nueva herramienta ----------------------------
Message "<< Moviendo eje Z a cero ..." 'Pone este mensaje en la barra de estado
Code "G53 Z" & ToolUp 'Subir el eje Z para alejarse de la herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Posicionado para coger nueva Herramienta ..." 'Pone este mensaje en la barra de estado
Call MovePos(ToolNew,"X") 'Mover primero eje X a la posición herramienta
Call MovePos(ToolNew,"Y") 'Mover eje Y a la posición coger herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G53 Z" & ToolDw 'Mover el Eje Z para tomar la Herramienta
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Posicionado completado ..." 'Pone este mensaje en la barra de estado

'---------- Coger nueva herramienta -------------------------------------------
Message "<< Desactivar Change Tool ..." 'Pone este mensaje en la barra de estado
Code "G4 P.25" 'Esperar un pequeño tiempo
DeActivateSignal(Output6) 'Desactivar la salida para coger la herramienta
'Esperar a el sistema neumatico del mandrino indique herramienta esta cogida
'SetTimer(2)
Ctime = 0
While Not(Not IsActive(input1) And IsActive(input2) And Not IsActive(input3))
'CTime = GetTimer(2)
CTime = CTime + 1
If CTime > 1000000 Then
Ret = MachMsg("No se ha podido COGER la Herramienta.... Por Favor revise el Circuito neumático del mandrino....", _
"Tool Change Warning", 5)
If Ret = 2 Then
'MachMsg("Cambio de Herramienta Cancelado....", "Tool Change", 0)
Message "<< Cambio de Herramienta Cancelado" 'Pone este mensaje en la barra de estado
Exit Sub
Else
'SetTimer(2) 'Inicializa el Temporizador
CTime = 0
End If
CTime = 0
End If
'Pregunta por si se ha producido un Error al coger la herramienta
If(IsActive(input1) And IsActive(input2) And Not IsActive(input3)) Then
MachMsg("Colector cerrado sin herramienta... Por favor revise el Colector del mandrino....", _
"Tool Change Warning", 0)
End If
Wend
Code "G4 P1.0" 'Esperar un pequeño tiempo
Message "<< Herramienta sujeta ..." 'Pone este mensaje en la barra de estado


'---------- Movimientos a Coordenadas Seguras ---------------------------------
Message "<< Moviendo eje Y a posición segura ..." 'Pone este mensaje en la barra de estado
Code "G53 Y" & ToolSf 'Desplaza eje Y a posición segura.
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G53 Z" & ToolUp 'Subir el Eje Z
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Message "<< Moviendo eje Z a cero ..." 'Pone este mensaje en la barra de estado

'---------- Asignar Herramienta recogida en el sistema ------------------------
Call SetUserDRO (1200,ToolNew)
SetCurrentTool( ToolNew )

'---------- Auto Tool Zero ----------------------------------------------------
'Code "(Iniciado Auto Tool Zero...)" 'Pone este mensaje en la barra de estado
'Code "G0 X100 Y100" 'Mueve a la posición de Prueba
'Code "G4 P5" 'Este tiempo me da para poder colocar la sonda
'Code "G31Z-10 F100" 'El movimiento de prueba, puede cambiar la velocidad
'While IsMoving() 'Esperar a que se ejecute el movimiento
'Wend
'ZProbePos = GetVar(2002) 'Obtener el punto exacto cuando la sonda sea golpeada
'Code "G0 Z" & ZProbePos 'Volver de nuevo a ese punto,
'While IsMoving () 'Esperar a que se ejecute el movimiento
'Wend
'Call SetDro (2, PlateThickness) 'Ajustar el eje Z a lo que se establece como espesor de la placa
'Code "G4 P0.25" 'Esperar un pequeño tiempo
'Code "G0 Z" & ToolUp 'Subir el Eje Z
'Code "(Moviendo eje Z a cero)" 'Pone este mensaje en la barra de estado

'---------- Regresar al punto de partida --------------------------------------
Message "<< Regresando al punto de partida ..." 'Pone este mensaje en la barra de estado
Code "G00 X" & x & " Y" & y '& " Z" & z  'Mueve la máquina al punto de partida
While IsMoving() 'Esperar a que se ejecute el movimiento
Wend
Code "G4 P1.00" 'Esperar un pequeño tiempo
Message "<< Cambio de Herramienta realizado" 'Pone este mensaje en la barra de estado

End Sub

Sub MovePos(ByVal ToolNumber As Integer, ByVal EjeMove As String)
'Subrutina donde estan las posiciones de cada herramienta
Select Case ToolNumber     
Case Is = 1
XPos = 125
YPos = 11.2
Case Is = 2
XPos = 299
YPos = 11.2
Case Is = 3
XPos = 474
YPos = 11.2
Case Is = 4
XPos = 815
YPos = 11.2
Case Is = 5
XPos = 991
YPos = 11.2
Case Is = 0 ' Posición de herramienta no existente
XPos = 1164
YPos = 11.2

End Select
       
If EjeMove = "X" Then
Code "G00 G53 X" & XPos
End If
If EjeMove = "Y" Then
Code "G01 G53 Y" & YPos & " F1500"
End If

End Sub

Hello muy friend, do you know do the automatic changer tool?
Title: Re: tool changer
Post by: TPS on December 05, 2022, 02:21:18 AM
i have not created this macro, just made some changes and never got an answer wether it work's.
Title: Re: tool changer
Post by: foxer_125 on December 05, 2022, 02:43:51 AM
i have not created this macro, just made some changes and never got an answer wether it work's.
Can you help me please?
Title: Re: tool changer
Post by: TPS on December 05, 2022, 02:57:45 AM
pls create a new thread and post all informations you have about ATC , your controller
maybe in/outputs you used and pictures of all.