G54 is changed in Z when using M6 tool change


Results 1 to 4 of 4

Thread: G54 is changed in Z when using M6 tool change

  1. #1
    Member TH-CRAFTS's Avatar
    Join Date
    May 2021
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default G54 is changed in Z when using M6 tool change

    Hi. I have an issue with my ATC router.
    I would be very grateful if someone can help me out.
    I have been strugling with this for some time and I'm not (yet) capable of understanding the M6 script.

    Background:
    I use Fusion 360 for CAD/CAM and Mach3 to run my router.

    I have set the G54 and every thing works fine till the tool change.
    The M6 is activated and the tool is changed and then at the end of M6 the G54 is changed in Z!

    It seems like something in the M6 script is taking the Z position of the machine exactly when it is leaving the tool change position and puts in that figure in to the G54 Z.

    I provide the M6 script, can someone please have a look on it?

    Regards Tomas


    M6Start
    'chengdu xhc technology ,all right reserved |
    'please don't modify these code if you don't know what you doing |
    '
    Declare Function ChangeTool Lib ".\Plugins\NcEther-8ts" () As Integer
    dim newtool
    Dim XWork, YWork,ZWork
    dim chanok
    Sub Main

    newtool=GetSelectedTool()
    OldTool = GetOEMDRO (824)
    If newtool = OldTool Then
    Message"Tool No Change"
    If Not FileName() = "No File Loaded." Then
    ActivateSignal(Output6)
    end if
    Exit Sub
    End If
    DoSpinStop() 'stop spindle
    SetUserDro(1384,newtool)
    XWork = GetOEMDRO(800) ' Get Current X Work Coordinate
    YWork = GetOEMDRO(801) ' Get Current Y Work Coordinate
    ZWork = GetOEMDRO(802)
    Call ChangeTool()
    chanok=GetUserDro(1338)
    If(chanok>2) Then
    SetCurrentTool(newtool)
    end if
    SetUserDro(1338,1)
    If Not FileName() = "No File Loaded." Then
    ActivateSignal(Output6)
    Sleep(100)
    DoSpinCW()
    'Code "G0 X" & XWork & " Y" & YWork
    'Sleep(500)
    'While IsMoving()
    'sleep(50)
    'Wend
    Code"G0Z"& ZWork
    Sleep(500)
    While IsMoving()
    sleep(50)
    Wend
    DoOEMButton(1000) ' Cycle Start
    end if
    End Sub



    M6 End
    REM The default script here moves the tool back to m6start if any movement has occured during the tool change..

    x = GetToolChangeStart( 0 )
    y = GetToolChangeStart( 1 )
    z = GetToolChangeStart( 2 )
    a = GetToolChangeStart( 3 )
    b = GetToolChangeStart( 4 )
    c = GetToolChangeStart( 5 )
    if(IsSafeZ() = 1) Then
    SafeZ = GetSafeZ()
    if SafeZ > z then StraightTraverse x, y,SafeZ, a, b, c
    StraightFeed x, y, z , a, b, c
    else
    Code"G00 X" & x & "Y" & y
    end if



  2. #2
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: G54 is changed in Z when using M6 tool change

    Quote Originally Posted by TH-CRAFTS View Post
    Hi. I have an issue with my ATC router.
    I would be very grateful if someone can help me out.
    I have been strugling with this for some time and I'm not (yet) capable of understanding the M6 script.

    Background:
    I use Fusion 360 for CAD/CAM and Mach3 to run my router.

    I have set the G54 and every thing works fine till the tool change.
    The M6 is activated and the tool is changed and then at the end of M6 the G54 is changed in Z!

    It seems like something in the M6 script is taking the Z position of the machine exactly when it is leaving the tool change position and puts in that figure in to the G54 Z.

    I provide the M6 script, can someone please have a look on it?

    Regards Tomas


    M6Start
    'chengdu xhc technology ,all right reserved |
    'please don't modify these code if you don't know what you doing |
    '
    Declare Function ChangeTool Lib ".\Plugins\NcEther-8ts" () As Integer
    dim newtool
    Dim XWork, YWork,ZWork
    dim chanok
    Sub Main

    newtool=GetSelectedTool()
    OldTool = GetOEMDRO (824)
    If newtool = OldTool Then
    Message"Tool No Change"
    If Not FileName() = "No File Loaded." Then
    ActivateSignal(Output6)
    end if
    Exit Sub
    End If
    DoSpinStop() 'stop spindle
    SetUserDro(1384,newtool)
    XWork = GetOEMDRO(800) ' Get Current X Work Coordinate
    YWork = GetOEMDRO(801) ' Get Current Y Work Coordinate
    ZWork = GetOEMDRO(802)
    Call ChangeTool()
    chanok=GetUserDro(1338)
    If(chanok>2) Then
    SetCurrentTool(newtool)
    end if
    SetUserDro(1338,1)
    If Not FileName() = "No File Loaded." Then
    ActivateSignal(Output6)
    Sleep(100)
    DoSpinCW()
    'Code "G0 X" & XWork & " Y" & YWork
    'Sleep(500)
    'While IsMoving()
    'sleep(50)
    'Wend
    Code"G0Z"& ZWork
    Sleep(500)
    While IsMoving()
    sleep(50)
    Wend
    DoOEMButton(1000) ' Cycle Start
    end if
    End Sub



    M6 End
    REM The default script here moves the tool back to m6start if any movement has occured during the tool change..

    x = GetToolChangeStart( 0 )
    y = GetToolChangeStart( 1 )
    z = GetToolChangeStart( 2 )
    a = GetToolChangeStart( 3 )
    b = GetToolChangeStart( 4 )
    c = GetToolChangeStart( 5 )
    if(IsSafeZ() = 1) Then
    SafeZ = GetSafeZ()
    if SafeZ > z then StraightTraverse x, y,SafeZ, a, b, c
    StraightFeed x, y, z , a, b, c
    else
    Code"G00 X" & x & "Y" & y
    end if
    You don't have to use anything in the G54Z0 is the norm unless you have set a master Tool and entered it in the G54Z----, a G43Z----H2(=T2) is where the Tool offsets are kept

    T2M6 (Tool number and Tool change call)

    G54 (=X / Y Position)

    S12000

    G0Z---- (This is only needed to clear your work if the M6 is not working correctly, or the Tool change is lower than your work)

    G90G0X4Y4. ( X/Y move to wherever it is set in start position in your Program)

    G43Z.1H2 (Tool OffSet Call and Z axis move above the part)

    Mactec54


  3. #3
    Member TH-CRAFTS's Avatar
    Join Date
    May 2021
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Re: G54 is changed in Z when using M6 tool change

    Hi and thanks for your reply!

    Due to short experience in code I have an issue following you and I'm worried that I do some kind of basic error.

    Can I just tell you how I set up the tool length and the G54?

    T1 I set to a fake length lets say H50mm that I enter in to the tool table
    With that tool in the spindle I touch the top of my part and set the G54. Typically my machine Z-position can be -100 and the G54Z will hence be -150

    Then I put in T2 maually in the spindle, and remember to switch to T2 in Mach3. I touch my part and store the T2 H-value in to the tool table. If T2 is 10mm longer than T1, the T2H will be 60.

    So what happens when I run the program below is that T1 works fine, but at line . N165-N175, when T2 goes out of the tool rack and start to spin, the G54 Z is changed to the machine position at that moment plus the tool compensation. Typically -200-150=-350.

    Can you understand why? You say in your comment;

    G0Z---- (This is only needed to clear your work if the M6 is not working correctly, or the Tool change is lower than your work)

    The tool change is lower than my work.

    Im very happy for your supprt. Regards


    My test program:
    (1001)
    (T1 D=10. CR=0. - ZMIN=-11. - FLAT END MILL)
    (T2 D=3. CR=0. - ZMIN=-6. - FLAT END MILL)
    N10 G90 G94 G91.1 G40 G49 G17
    N15 G21
    N20 M7

    (2D CONTOUR1)
    N25 M5
    N30 T1 M6
    N35 S5000 M3
    N40 G54
    N45 G0 X-43.362 Y-1.
    N50 G43 Z15. H1
    N55 Z5.
    N60 G1 Z1. F333.
    N65 Z-10.
    N70 G18 G2 X-42.362 Z-11. I1. K0. F1000.
    N75 G1 X-41.362
    N80 G17 G3 X-40.362 Y0. I0. J1.
    N85 G1 Y28.582
    N90 G2 X-35.362 Y33.582 I5. J0.
    N95 G1 X35.362
    N100 G2 X40.362 Y28.582 I0. J-5.
    N105 G1 Y-28.582
    N110 G2 X35.362 Y-33.582 I-5. J0.
    N115 G1 X-35.362
    N120 G2 X-40.362 Y-28.582 I0. J5.
    N125 G1 Y0.
    N130 G3 X-41.362 Y1. I-1. J0.
    N135 G1 X-42.362
    N140 G18 G3 X-43.362 Z-10. I0. K1.
    N145 G0 Z15.
    N150 G17

    (SLOT1)
    N155 M5
    N160 M1
    N165 T2 M6
    N170 S5000 M3
    N175 G54
    N180 G0 X25.014 Y-5.587
    N185 G43 Z15. H2
    N190 Z5.
    N195 G1 Z2.5 F333.
    N200 Z-6.
    N205 X-27.133 F1000.
    N210 G0 Z15.

    N215 M9
    N220 M30



  4. #4
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: G54 is changed in Z when using M6 tool change

    Quote Originally Posted by TH-CRAFTS View Post
    Hi and thanks for your reply!

    Due to short experience in code I have an issue following you and I'm worried that I do some kind of basic error.

    Can I just tell you how I set up the tool length and the G54?

    T1 I set to a fake length lets say H50mm that I enter in to the tool table
    With that tool in the spindle I touch the top of my part and set the G54. Typically my machine Z-position can be -100 and the G54Z will hence be -150

    Then I put in T2 maually in the spindle, and remember to switch to T2 in Mach3. I touch my part and store the T2 H-value in to the tool table. If T2 is 10mm longer than T1, the T2H will be 60.

    So what happens when I run the program below is that T1 works fine, but at line . N165-N175, when T2 goes out of the tool rack and start to spin, the G54 Z is changed to the machine position at that moment plus the tool compensation. Typically -200-150=-350.

    Can you understand why? You say in your comment;

    G0Z---- (This is only needed to clear your work if the M6 is not working correctly, or the Tool change is lower than your work)

    The tool change is lower than my work.

    Im very happy for your supprt. Regards


    My test program:
    (1001)
    (T1 D=10. CR=0. - ZMIN=-11. - FLAT END MILL)
    (T2 D=3. CR=0. - ZMIN=-6. - FLAT END MILL)
    N10 G90 G94 G91.1 G40 G49 G17
    N15 G21
    N20 M7

    (2D CONTOUR1)
    N25 M5
    N30 T1 M6
    N35 S5000 M3
    N40 G54
    N45 G0 X-43.362 Y-1.
    N50 G43 Z15. H1
    N55 Z5.
    N60 G1 Z1. F333.
    N65 Z-10.
    N70 G18 G2 X-42.362 Z-11. I1. K0. F1000.
    N75 G1 X-41.362
    N80 G17 G3 X-40.362 Y0. I0. J1.
    N85 G1 Y28.582
    N90 G2 X-35.362 Y33.582 I5. J0.
    N95 G1 X35.362
    N100 G2 X40.362 Y28.582 I0. J-5.
    N105 G1 Y-28.582
    N110 G2 X35.362 Y-33.582 I-5. J0.
    N115 G1 X-35.362
    N120 G2 X-40.362 Y-28.582 I0. J5.
    N125 G1 Y0.
    N130 G3 X-41.362 Y1. I-1. J0.
    N135 G1 X-42.362
    N140 G18 G3 X-43.362 Z-10. I0. K1.
    N145 G0 Z15.
    N150 G17

    (SLOT1)
    N155 M5
    N160 M1
    N165 T2 M6
    N170 S5000 M3
    N175 G54
    N180 G0 X25.014 Y-5.587
    N185 G43 Z15. H2
    N190 Z5.
    N195 G1 Z2.5 F333.
    N200 Z-6.
    N205 X-27.133 F1000.
    N210 G0 Z15.

    N215 M9
    N220 M30
    Because you are setting each tool to the top of your work / job you do not want to be using a dummy tool for G54 your G54 you should leave at Z= (0) then set each tool to the top of your part, this will then be in the tool 0ffSet settings

    So, if you see in you posted code G43 Z15. H1 this then sets your tool (1) to the correct 0ffSet from the tool 0ffSet page and the same will happen for each tool you use

    You have a G43Z15H1 this gets the information from what you entered in the tool 0ffSet page

    Your second Tool G43 Z15. H2 gets the stored information from what you entered in the tool 0ffSet page

    The method you are trying to do is normally used with a Tool Setter

    Mactec54


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

G54 is  changed in Z when using M6 tool change

G54 is  changed in Z when using M6 tool change