I’ve been there before. Editing g-code is daunting at first because of the bad things you can do, but knowing the commands and how they work helps. There are a lot of websites that give a definition of the g-code commands, but this one seems to have the most detailed explanation of the most used of them: https://howtomechatronics.com/tutorials/g-code-explained-list-of-most-important-g-code-commands/
This one has a complete list, with a simple explanation: G-Code and M-Code Command List for CNC Mills [ Examples & Tutorials ]
But for what you want, you can start small and just learn the g-code commands you need to eliminate for this repetitive work. You are going to want to get rid of the following commands for this repetitive work.
To be clear - you should save this modified g-code file with an appended name like: [filename]-repeat.nc or.gcode, whatever the extension is you are using. This will be the file you run for the 2nd through nth time of your production run.
You will want to remove the following commands at the beginning of the code:
M6 or M06 - this is the tool change command. Typically seen as: T[tool number] M6, so “T105 M6” This will eliminate the BitSetter cycle.
M3 or M03- This is your spindle speed. This eliminates your dialog box if you are not using the BitRunner. Typically seen as: M3 S[spindle speed], so “M3 S24000”. If you are using the BitRunner, I would leave it alone. I run my spindle manually, so I got rid of this command to eliminate the dialog box. Here is some code generated with MakerCam. Everything in bold is my comments.
(Generated by PartKam Version 0.05)
G20 <== Dimensions are in inches. G21 is for mm.
G90 <== Absolute programming. X1 Y1 means go to X=1" Y=1", not go 1" in the X and 1" in the Y direction from current location.
G40 <== Tool cutter compensation off. Honestly, not sure, never looked it up, but I don’t think it needs to be there.
(01 2500SC)
G0 Z0.1
T0 M6 <== Change to tool number 0
G17 <== Select X-Y plane. Some g-code generators have this, some don’t.
M3 <== Turn on spindle in the CW direction, no speed indicated.
G0 X0.731 Y8.183
G1 Z-0.05 F30
G3 X0.7502 Y8.1805 I0.0193 J0.072 F45
That’s it for the beginning of the code. Now to the bottom of the code.
M5 or M05 - Spindle Stop. If you are not using the BitRunner, you can delete it. I don’t know how CM would respond if you did have the BitRunner and deleted it.
M30 - End Program. This is the command that tells CM that it is done, and CM sends the spindle back to the home position. I got rid of it, and instead just have the last command to raise my Z to 1" above stock for all of my programs. If you are feeling adventurous, you can figure out how far back you want it to go to clear your stock so you can put a new piece in, and have it go up to a safe height, then back to get out of the way. You have to be careful with doing that, because if you set up in a different location, that backing up could cause problems. If you do that, you should just delete the modified program or note that you should only use it in one location on your wasteboard.
So, the last commands look like this:
G3 X0.0072 Y9.004 I0.1527 J-0.3946
G3 X-0.0868 Y8.8712 I0.2782 J-0.2967
G3 X-0.12 Y8.7137 I0.3575 J-0.1575
G0 Z0.1 <== Change this to “G0 Z1” or “G0 Z25” for mm to move up to 1" above zero.
M5 <== Probably best to leave alone with BitRunner, delete if manual spindle control.
M30 <== Delete to stop spindle from homing at the end of the program.