Shorten Your G-Code Using a WHILE Loop! | CNC Macro Programming Tutorial

Поділитися
Вставка
  • Опубліковано 12 вер 2024
  • ‪@GCodeTutor‬ demonstrates how to remove a large amount of material writing only 9 lines of G-code.
    As we saw in other videos in this series of CNC programming tutorials, Macro B variables are a great way to simplify your G-code programs and make them easier to read and modify.
    In this video, Marc Cronin shows how to write a Macro program using a WHILE loop.
    To learn more about G-code and CNC macro programming, visit Gcodetutor.com (rb.gy/7yzqfn).
    Stay tuned for more machining videos!
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Recommended CNC programming books:
    Fanuc CNC Custom Macros - amzn.to/370yX0P
    CNC Programming Handbook - amzn.to/2MPxT9g
    CNC Programming Techniques - amzn.to/3aTS4el
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Practical Machinist is the largest and most engaged metalworking community across the web. With more than 160,000 registered members and 300,000+ social media followers, Practical Machinist is the easiest way to learn new techniques, get answers quickly, and discuss common challenges with your peers. Visit Practical Machinist today to join the community and start connecting with your peers.
    Become a Practical Machinist member (www.practicalm...)
    Like us on Facebook ( / practicalmachinist )
    Follow us on Instagram ( / practicalmachinist )
    Follow us on Twitter ( / prac_machinist )
    Connect with us on LinkedIn ( / practical-machinist )
    #Gcode #CNCprogramming #macroprogramming

КОМЕНТАРІ • 9

  • @lcmac4765
    @lcmac4765 3 роки тому +4

    You guys are like free school. Thanks for all the info

  • @faradynemotors9147
    @faradynemotors9147 2 роки тому +2

    I usually use go-to subs for that sort of thing with G91 moves, but this technique seems like it is a good tool to have in the box of tools to use. I've heard some folks get wound up about mixing G90 & G91 but the fella that taught me G-code basics 30 years ago used both routinely without thinking much about it.

  • @iliandimitrov4857
    @iliandimitrov4857 3 місяці тому

    These examples are very helpfull indeed, thank you!

  • @---MarcosVanzuita---
    @---MarcosVanzuita--- 11 місяців тому

    Muito shoy este tutorial de repetição do WHILE...... Parabéns!👏👍

  • @somethingelse4424
    @somethingelse4424 Рік тому

    I kept having a 1 in 100 intermittent tool change issue where the machine would throw tools randomly against the walls, fixture, parts, etc. Maintenance wouldn't believe me--they'd watch it do ten tool changes and walk away. So then the machine would throw a drill randomly, nobody would notice, then try to bore a non existent hole, and have a cascading effect of tool destruction and scrap material. I eventually wrote a while loop that would do a continuous (user specified) loop of tool changes to prove I wasn't crazy. Well it worked, but it blew the thermal breaker on the ATC system almost immediately and I just about shit myself thinking I destroyed the machine. Lucky it just took a hard reset and was fine. I added a G04 dwell between tool changes before I showed off my fancy macro to anyone. Be careful, and always test your code with a variety of inputs.

  • @KoenBrader
    @KoenBrader 3 роки тому +1

    Why do you count down? Isn’t there a “less than” or “less than or equal” ann increment to that?

    • @rfigueroa93rf
      @rfigueroa93rf 3 роки тому

      You can write which ever which way you’d like to orient your positives and negatives. But using absolute positioning, and with your Y0 at the top left, it makes more sense to leave it moving DOWN by 10. Hence the minus.
      In summary, it’s best if you choose a system and stick to it. Up and right= positive, down and left= negative.

  • @Bagginsess
    @Bagginsess 3 роки тому +1

    I wonder why the programming language enigneers didn't use "" for "LT" like in other programming languages.

    • @somethingelse4424
      @somethingelse4424 Рік тому +2

      That would make way more sense to me too. The most reasonable answer I can come up with is that the < and > symbols don't exist on fanuc controllers pre-macro era. However the brackets [ ] also didn't have a pre-macro language use... So that kind of torpedoes my theory that all the characters making up LT GT GE EQ all had existing uses prior to "complex" macro logic. Having had a little C++ and VB experience before getting into GCODE, that also frustrates me. Maybe brackets were the bare minimum addition to the keypad to enable higher logic, as parenthesis would be interpreted as comments. They could get by with using E Q L T G without adding keys and losing backwards compatibility.