If statements?

Has anyone tackled using If statements and counters with G code?
I need to drill 24 groups of 5 holes (4x) So about 400 holes (think Cribbage).
Is it even possible with our computing power?

There are some advanced gcode commands that can handle some logic and subroutines. AFAIK, Marlin doesn’t support them, even with a different configuration.

If I were doing that, I would do that in a higher level language, like python, and just write out all the movements in gcode from the python. Javascript, perl, visual basic, sed/awk/bash whatever you know.

1 Like

What operation do you need to do that would require conditional logic? A CNC is (should be) non interactive and deterministic. You put a static design in, and get the result out. Conditional logic is generally reserved for interactive experiences, or graceful handling of exceptional behavior (errors).

If you explain your situation more, maybe we can help figureout a better way to do what you want.

For example it seems like you just want to model 400 holes (or multiple batches of 24) fast, without all of the manual effort. Fusion 360 has “patterns”. You can create a single hole (or even more complex geometry), select it as a pattern, and make a pattern of 400 holes (or groups of 24) in seconds.

These patterns can be formed in a rectangle, circle, or along a pre-set path.

1 Like

If one really needs advanced gcode handling, there is no way around LinuxCNC. But as mentioned here already, it is not essential in most cases.

1 Like

the issues I was having was working with that many holes in Freecad was almost impossible. With all of the constraints it was taking a couple minutes between each move and each dimensional change. I ended up breaking the print up into several parts and then re assembling them in Estlcam to generate the code. I’m not very familiar with Fusion 360.
Thank you for the suggestions though.

Can we see a picture of the finished product? Were you modeling as 3D ?