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

Поділитися
Вставка
  • Опубліковано 24 січ 2025

КОМЕНТАРІ • 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 8 місяців тому

    These examples are very helpfull indeed, thank you!

  • @---MarcosVanzuita---
    @---MarcosVanzuita--- Рік тому

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

  • @somethingelse4424
    @somethingelse4424 2 роки тому

    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 роки тому +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.