Hello Guest it is March 28, 2024, 10:29:56 PM

Show Posts

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.


Topics - Marco A

Pages: 1
1

'**************************************************************************
'*   Macro for automatic tool changer (ATC) in the script M6Start.m1s
'*   with two axis moving the ATC.
'*
'*   Description:
'*
'*   We used two axis (B-Axis and C-Axis) to move two motors, one motor
'*   is used to move the ATC (with the B-axis). And, the C-axis
'*   (The second motor) is used to rotate the ATC and select the tool.
'*   It is used one out (output1) to hold or relase the tool, when it is
'*   necessary.
'*
'*    Process:
'*
'*    1. Z-axis goes to "Z zero".
'*    2. Then, Z-axis moves to the height of the ATC.
'*    3. The ATC comes to a programed position with the B-axis, and takes
'*      the tool.
'*    4. The output1 relases the tool and Z-axis goes up.
'*   5. Whith the C-axis we rotate the ATC to the new tool.
'*     6. The Z-axis goes down and holds the tool activating Output1.
'*    7. The ATC returns to the start position and Z-axis returns to
'*      home.
'*
'*
'*    Caution:
'*
'*   It is necessary consider two inputs for home, one for
'*   each axis (C and B) Because they need a start position to know
'*   when the ATC takes the tool or where is each tool.
'*   Also is necessary to edit the buttonĀ“s script "Ref all home" with
'*   the code "DoButton( 25 ), DoButton( 26 )", letting ATC found a
'*   start position, and in the menu "General Config" indicate that
'*   axis B and C works like rotative axis.
'*   The units of the axis B and C are in degrees.
'*
'*               Marco A Perez C.
'*                Sadosa S.A. de C.V.
'*
'* '**************************************************************************



Sub Main()         'Definir variables
OldTool = GetOEMDRO (1200)    
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
tool = GetSelectedTool()
NewTool = tool
MaxToolNum = 5            'Maximum number of tools to use.
ToolDown   = -50       'Height for tool change.
ToolUp     = 0.0          'Height the Z-axis during tool change.
If NewTool = OldTool Then
   Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Place valid tool number (1 to 5)")
Wend
Call MovePos(OldTool)      'The ATC identifies the old tool.
While IsMoving()
Wend
Code "G53 Z" & ToolDown      'The Z-axis goes to ATC height
Code "G4 P.75"
While IsMoving()
Wend
Code "G00 G53 B1.0"      'The ATC moves to Z-axis and takes the tool
While IsMoving()
Wend
ActivateSignal(Output1)    'Send signal to relase tool.
Code "G4 P1.0"          'Wait a second.
Code "G53 Z" & ToolUp      'The Z-axis goes up and waits here.
Call  MovePos(NewTool)      'The ATC moves to the new tool.
While IsMoving()
Wend
Code "G53 Z" & ToolDown      'Z-axis moves down and takes the tool
Code "G4 P.75"
While IsMoving()
Wend
DeActivateSignal(Output1)    'Send signal to hold tool.
Code "G4 P1.0"          'wait a second.
While IsMoving()
Wend
Code "G00 G53 B0.0"      'The ATC returns to start position.
While IsMoving()
Wend

Code "G53 Z" & ToolUp      'The Z-axis up, and it's ready to use.
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
End Sub

Sub MovePos(ByVal ToolNumber As Integer)

Select Case ToolNumber      'Positions to each tool in C-axis
       Case Is = 1
         Code "G00 G53 C1.0"
       Case Is = 2
         Code "G00 G53 C2.0"
       Case Is = 3
         Code "G00 G53 C3.0"
       Case Is = 4
         Code "G00 G53 C4.0"
       Case Is = 5
         Code "G00 G53 C5.0"
       Case Is = 6
         Code "G00 G53 C6.0"
       Case Is = 7
         Code "G00 G53 C7.0"
       Case Is = 8
         Code "G00 G53 C8.0"
End Select

End Sub
Main   

2
Here is a macro for automatic tool changer.

'********************************************************
'*
'*   Macro for the Automatic tool changer in script M6Start.m1s
'*
'*   Description:
'*
'*   We have defined fixed positions for each tool.
'*   When you input M6 code and a new tool,
'*   First, the Z axis goes to "machine zero",
'*   then goes to the position of the last tool used
'*   and leaves the tool. After that, the Z axis goes
'*   to the new tool position and takes the new tool. 
'*   Finaly, returns to "Machine zero".
'*   Before the program begins, the macro checks if the
'*   tool number is valid.
'*
'*    Process:
'*
'*    1. Z-axis goes to "Machine zero"
'*    2. Then, Z-axis goes to the safe position defined by the user.
'*    3. The Z axis goes down to the height to the tools.
'*    4. Z axis moves to the position of the last tool, moving the
'*   X-axis before the Y-axis.
'*   5. The spindle releases the actual tool and the z-axis moves to
'*   the position of the new tool.
'*    6. The Z-axis takes the new tool and returns at the safe position
'*   7. Z-axis goes to "Machine Zero".
'*
'*
'*                                               Marco A. Perez C.
'*                   Sadosa S.A. de C.V.
'*
'* ***********************************************************************

Sub Main()         'Define variables
OldTool = GetOEMDRO (1200)    
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
tool = GetSelectedTool()
NewTool = tool
MaxToolNum = 5            'Maximum number of tools to use.
ToolDown   = -50       'Height for the tool change.
ToolUp     = 0.0          'Height the Z-axis for the tool change.
PosSec      = 50.0      'Safe Position.
If NewTool = OldTool Then
   Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Place valid tool number (between 1 y 5)")
Wend
Code "G00 G53 Z" & ToolUp     'The z-axis is going to "machine zero"
While IsMoving()
Wend
Code "G53 y" & PosSec       'Going to safe position.   
While IsMoving()
Wend
Code "G53 Z" & ToolDown      'Down to the height of tools
While IsMoving()
Wend
Call MovePos(OldTool)      'Going to the last position to relase the old tool.
While IsMoving()
Wend
ActivateSignal(Output1)    'Relase the tool.
Code "G4 P1.0"
Code "G53 Z" & ToolUp        
While IsMoving()
Wend
Call MovePos(NewTool)      'Go to the new tool position.
While IsMoving()
Wend
Code "G53 Z" & ToolDown      'down the z-axis to hold the tool.
While IsMoving()
Wend
DeActivateSignal(Output1)    'hold the new tool.
Code "G4 P1.0"
Code "G53 y" & PosSec       'Returns to the safe position.
While IsMoving()
Wend
Code "G53 Z" & ToolUp      'Returns z-axis to "machine zero".
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
End Sub

Sub MovePos(ByVal ToolNumber As Integer)

Select Case ToolNumber      'Here set the position of each tool.
       Case Is = 1
         Code "G00 G53 x12.0"
    Code "G00 G53 y5.0"
       Case Is = 2
         Code "G00 G53 x24.0"
    Code "G00 G53 y5.0"
       Case Is = 3
         Code "G00 G53 x36.0"
    Code "G00 G53 y5.0"
       Case Is = 4
         Code "G00 G53 x48.0"
    Code "G00 G53 y5.0"
       Case Is = 5
         Code "G00 G53 x60.0"
    Code "G00 G53 y5.0"
End Select

End Sub
Main   

Pages: 1