Need Help! M6 Macro locking out the machine

Results 1 to 9 of 9

Thread: M6 Macro locking out the machine

  1. #1
    Member
    Join Date
    Mar 2012
    Location
    Norway
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default M6 Macro locking out the machine

    Hi, i got a friend of mine wrighting a little m6 script for me as i change my tool manual on my BT30 spindle, script does what it should do, but i got a problem that it sometimes locks UCCNC up abit, if i do an M30 in MDI, then it gets good again.
    But this does not work when cutting a part, as it will offcourse stop the gcode file and heat to start again on the first tool change done.

    Anyone know why this messes it up ?

    (I tried adding M30 at the end, but commented it out as it messed up)

    Try to overlook the Norwegian language inn here

    // ************************************************** ******************

    int newXPos = -390;
    int newYPos = -600;
    int newZPos = 0;
    int Newtool = exec.Getnewtool(); // Henter nytt tool
    int Currenttool = exec.Getcurrenttool(); // Henter nåværende tool

    // Hvis nytt toolnummer er -1 så mangler det en T code, så da stopper det her
    if (Newtool == -1)
    return;

    // Samme tool som forrige tool
    if(Newtool == Currenttool)
    return;

    // Sjekk om det er utført Homing
    if(!exec.GetLED(56) || !exec.GetLED(57) || !exec.GetLED(58))
    {
    MessageBox.Show("Maskinen har ikke kjørt Homing. Utfør Homeing før skifte av tool!");
    exec.Stop();
    return;
    }

    // Hent maskinens XY koordinater, slik at maskinen kan returnere dit etter toolskifte
    double Xoriginalpos = exec.GetXmachpos();
    double Yoriginalpos = exec.GetYmachpos();

    // Stopp spindle
    exec.Stopspin();
    while(exec.IsMoving()){}

    // Slå av flood
    exec.Code("M09");
    while(exec.IsMoving()){}

    // Flytt opp Z til 0
    exec.Code("G00 G53 Z" + newZPos);
    while(exec.IsMoving()){}

    // Flytt X og Y til angitt plass
    exec.Code("G1 F5000 G53 X" + newXPos + " Y" + newYPos);
    while(exec.IsMoving()){}

    exec.Wait(200);

    // Vent på at Cycle-Start blir trykket på hovedskjerm
    while(!AS3.Getbutton(128));

    // ************************************************** ********************
    // Her antar vi da at tool er skiftet og bruker har trykket Cycle-start
    // ************************************************** ********************

    // Flytt tilbake til startkoordinatene
    exec.Code("G1 F5000 G53 X" + Xoriginalpos + " Y" + Yoriginalpos);
    while(exec.IsMoving()){}

    // Sett offset til nytt tool
    exec.Code("G43 H" + Newtool);
    exec.Wait(200);

    // Hvis toolbytte ikke ble avbrutt av at bruker har trykket stop i GUI, så kan nytt tool valideres og settes til aktiv tool.
    if(!exec.Ismacrostopped())
    {
    exec.Setcurrenttool(Newtool); //Set nåværende tool til nytt tool
    // MessageBox.Show("Toolskifte ferdig.");
    }
    else
    {
    exec.StopWithDeccel();
    MessageBox.Show("Toolskifte ble avbrutt av bruker");
    }
    // Stop script
    //exec.Code("M30");
    //exec.Wait(200);


    Similar Threads:


  2. #2
    Member
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    287
    Downloads
    5
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    Having a quick look, a couple of things I noticed:

    // Slå av flood
    exec.Code("M09 should be exec.Code("M09");
    while(exec.IsMoving()){}

    And at the bottom although it is commented out, I see the same thing:

    // Stop script
    //exec.Code("M30 should be //exec.Code("M30");
    //exec.Wait(200);



  3. #3
    Member
    Join Date
    Mar 2012
    Location
    Norway
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    thanks, will correct that, anything else that could get the cnc to act up ? it does do it's job, but all og the sudden it will just stop working when doing manual tool changing.

    Sent fra min SM-G975F via Tapatalk



  4. #4
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    Add some messages to the status window after each step so you know where it's stopping.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  5. #5
    Member
    Join Date
    Mar 2012
    Location
    Norway
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    good tip ger

    Sent fra min SM-G975F via Tapatalk



  6. #6
    Member
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    287
    Downloads
    5
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    Quote Originally Posted by Beefy View Post
    Having a quick look, a couple of things I noticed:

    // Slå av flood
    exec.Code("M09 should be exec.Code("M09");
    while(exec.IsMoving()){}

    And at the bottom although it is commented out, I see the same thing:

    // Stop script
    //exec.Code("M30 should be //exec.Code("M30");
    //exec.Wait(200);
    Hmmm, that's interesting.

    Looks like the forum is removing the "); off the end of the code in my previous post.



  7. #7
    Member
    Join Date
    Mar 2012
    Location
    Norway
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    i belive so too, as when i checked the macro on the cnc comp, it was fine

    Sent fra min SM-G975F via Tapatalk



  8. #8
    Member
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    287
    Downloads
    5
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    HOPEFULLY THE FORUM DOES NOT KEEP CHANGING THE CODE I WRITE...............................
    EDIT - YES IT DOES , SO I ATTACHED A SCREENSHOT OF WHAT I WROTE.



    Aha, then what about this line:

    exec.Code("G43 Newtool);

    Should it be exec.Code("G43" +Newtool);

    This is the notes from the UCCNC manual on G43:

    Tool Length Offsets : G43, G44 and G49
    To use a tool length offset, program G43 H…, where the H number is the desired index in the tool
    table. The H number should be, but does not have to be, the same as the slot number of the tool
    currently in the spindle. It is OK for the H number to be zero, an offset value of zero will be used.
    It is an error if:
    • the H number is not an integer, is negative, or is larger than the number of carousel slots, which is
    currently set to a value of 20.
    The G44 command is similar to the G43, but for negative tool length offsets.
    57/87
    To cancel the tool length offset compensation, program G49.
    It is OK to program using the same offset already in use. It is also OK to program using no tool
    length offset if none is currently being used.


    So should it be exec.Code("G43 H" +Newtool);

    Attached Thumbnails Attached Thumbnails M6 Macro locking out the machine-screenshot-post-jpg  
    Last edited by Beefy; 11-28-2020 at 05:06 AM.


  9. #9
    Member
    Join Date
    Mar 2012
    Location
    Norway
    Posts
    34
    Downloads
    0
    Uploads
    0

    Default Re: M6 Macro locking out the machine

    I have currently set the spindle nose as tool 0 and every tool is calculated from that, so all tools are positive from that offcourse.

    tool changes works, but now and then it stops working after tool change is done.
    the machine just does not reply to anything, but if i use MDI and type M30, it works again.

    it's like it is not done with tool change.

    i have since then removed the reply that tool change is done, as i got tired of getting pop up message that tool change was done + pressing cycle start after.

    i dont have a tool rack yet, so changing out the tools by hand (starting to get tired of that, so have plans of adding a toolrack perhaps at the end of the year)

    Sent fra min SM-G975F via Tapatalk



Tags for this Thread

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

M6 Macro locking out the machine

M6 Macro locking out the machine