How to Edit Part Count in a CNC Machine
Two counters matter: the one in the controller that stops the spindle, and the one in the CAM setup that decides how many parts you nest. This guide walks through both, from a single prototype to a 10,000-part run. By the end you will know which number to change, which to leave alone, and what to check before the first chip.

In this article
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Key takeaways
What the part count actually controls
On the machine side, the part count is a register inside the CNC controller. You set a target quantity, and the control compares it to the number of completed cycles. When the two match, the control stops the program, sounds an alarm, or lights a lamp. That is all it does. It is a counter, not a scheduler.
On the CAM side, the part count is a setup parameter. It tells the software how many identical workpieces come out of one bar, one plate, or one casting. Change it from 1 to 8 and the toolpath, the stock model, and the cycle time all change with it. This is where cost is decided.
The two numbers are linked but not equal. A machine may run one program cycle that produces four parts from a single tombstone fixture. The controller counts one cycle; the shop counts four parts. If you edit only the controller value, you will stop the machine at one quarter of the intended output.
So before you touch anything, decide what you are editing: a cycle counter for the operator, or a quantity in the process plan. Mixing them up is the most common cause of a short run.
- 1Controller registerCounts completed cycles, not finished pieces.
- 2CAM setup countCounts pieces per bar, plate, or casting.
- 3Fixture multiplierPieces per cycle. Keep it visible next to the counter.
What to check before you edit the value
Put the machine in MEM or MDI mode and stop the spindle. Most controls ignore counter edits during automatic operation, and a few will fault if you try. If the part is mid-cut, finish the cycle or use feed hold and spindle stop first. Never edit a counter while an axis is moving.
Confirm the offset page matches the current job. A counter edit on a machine still holding the previous setup's work offset will stop at the right number but produce the wrong parts. Check work offset, tool offsets, and the active program number on the screen.
Write down the old value. If the new count is wrong, you want a known number to return to. A setup sheet with three columns, old value, new value, and time, takes ten seconds and has saved many runs.
Decide what should happen at the target. On many controls you can choose between a simple stop, a stop with alarm, or a stop with M00. For lights-out or unattended cells, an alarm is safer because it is visible on the network. For manual loading, a plain stop is usually enough.
- 1Mode checkMEM or MDI, spindle stopped, no axis motion.
- 2Offset checkWork and tool offsets must match the current job.
- 3Record the old valueWrite it on the setup sheet before you change it.
Why the counter stops at the wrong number
The counter reads two cycles per part. This happens when the program ends with M30 and a subprogram also returns with M99 into the main body. The control counts both ends. Look at the end of the program and make sure only one cycle-end block increments the counter.
The counter resets on every M30. Many controls clear the part counter at M30 by default. If your batch keeps returning to zero, check the counter reset parameter or switch to a counter that M30 does not touch. This is a parameter setting, not a programming error.
The counter keeps running after the target. On some controls the target is a display only, and the stop comes from a separate M-code or macro. If the machine never stops, the target field is not linked to the stop output. Read the setting page again.
The count is right but the parts are short. A fixture holding four pieces per cycle needs a target of 250 cycles for 1,000 parts, not 1,000 cycles. Keep the pieces-per-cycle number on the setup sheet so nobody has to divide under pressure.
Power loss or an E-stop drops the counter. If the control does not keep the value in non-volatile memory, the count restarts at zero. For long runs, log the count at every shift change so a restart can be corrected by hand.
- 1Double incrementTwo cycle-end blocks in one program.
- 2Auto resetM30 clears the counter by parameter default.
- 3Target not linkedDisplay field is not wired to the stop output.
Editing the count in CAM and process planning
In CAM, the setup quantity changes the stock model. Set 8 parts from one 3,000 mm bar and the software lays out the nesting, the remnant, and the parting operations. Set 1 and you get a single-part program with a long remnant. The machining time per part usually drops as the count rises, because the remnant is shared.
For milled parts from plate, the count decides how many blanks you nest on one plate. A 500 × 500 × 450 mm work envelope can hold several small blanks at once. The trade-off is fixturing: more blanks per cycle means more clamping points and a longer setup, which only pays off above a certain quantity.
The break-even is not a fixed number. It depends on setup time, material cost, and how much of the bar or plate becomes scrap. A part with a 40-minute cycle and a 30-minute setup benefits from higher nesting. A part with a 3-minute cycle and a 2-hour setup often does not.
When the count changes, the program number, the fixture, and the inspection plan should change with it. An inspection plan written for one part per cycle will sample the wrong pieces when four come off the tombstone. Update the plan before the first production cycle, not after.
- 1Bar workHigher count shares the remnant, lowers time per part.
- 2Plate workMore blanks per cycle means more clamping points.
- 3Inspection planMust match pieces per cycle, not cycles.
Symptoms, causes, and what to do
Machine stops after one part when you asked for 250. The target field was not written, only displayed. Key the value again and press INPUT until the field shows the new number without a cursor.
Machine never stops. The target is set but the stop output is disabled in the setting page. Enable the stop or alarm output, or the run will continue until the bar runs out.
Count reaches the target but the batch is short. Pieces per cycle is greater than one. Multiply the target by the fixture multiplier, or the run stops at a fraction of the order.
Counter resets after every cycle. M30 is clearing the register. Change the reset parameter or use a counter that M30 does not clear, then verify with a dry run.
Two operators report different counts at handover. One is counting cycles, the other is counting pieces. Put both numbers on the setup sheet with clear labels so the shift change takes thirty seconds.
- 1Stops too earlyTarget not written or fixture multiplier ignored.
- 2Never stopsStop output disabled in the setting page.
- 3Resets each cycleM30 clearing the counter register.
How to edit part count in cnc machine controls, step by step
Applies to Fanuc-style controls and most ISO-panel machines. Screen names vary, logic does not.
- 11. Park the machine and open the counter pageSelect MEM or MDI mode. Press the OFFSET/SETTING key, then the SETTING soft key until the counter page appears. On some controls it sits under POS, then the right arrow until you see the work or part counter. Do not proceed if the spindle or any axis is moving.
- 22. Identify which counter you are onControls usually show a part counter, a run-time counter, and sometimes a tool-use counter on the same page. Read the labels before typing. The part counter is the one that stops the program. If you edit the run-time counter by mistake, nothing will stop and you will overrun the batch.
- 33. Set the target quantityMove the cursor to the part count target field, key in the number, and press INPUT or WRITE. For a first article, set 1 and prove the setup. For a full run, set the full batch, for example 250 pieces. On many controls you can also set the current value back to zero here.
- 44. Choose the stop behaviorIn the setting page, pick whether the machine stops, alarms, or switches a signal at the target. Use a stop with alarm for unattended runs. Use a plain stop for manual loading, where the operator is standing at the door anyway. Confirm the choice is stored, not just displayed.
- 55. Verify with a dry runRun the program in single block with rapid override low, or use machine lock if your control supports it. Watch the counter increment once per M30 or per cycle end. It should go from 0 to 1 on the first cycle. If it jumps by two, your program ends the cycle twice and the counter will stop early.
- 66. Record the edit and start the runWrite the old value, the new value, and the time on the setup sheet. Confirm the first article against the drawing, then release the run. If the batch is split across shifts, note the counter value at handover so the next operator does not reset it.
- 77. After the run, reset deliberatelyClear the counter only after the last article is inspected and the batch is logged. Resetting early is how a run gets restarted from zero and doubles the output by accident. Some shops lock the setting page with a parameter or key switch to prevent this.
Which count to edit, and when
Use this to pick the right field before you start typing.
| Situation | Edit this | Leave alone | Why |
|---|---|---|---|
| Single prototype, one setup | CAM quantity = 1 | Controller target | No batching, no nesting benefit |
| First article on a new fixture | Controller target = 1 | CAM quantity | Prove the setup before the batch |
| Bar-fed lathe, 8 parts per bar | CAM quantity = 8 | Fixture multiplier | Nesting drives the cycle time |
| Tombstone, 4 pieces per cycle | Fixture multiplier = 4 | Controller target | Target is cycles, not pieces |
| Unattended overnight run | Stop behavior = alarm | Counter reset parameter | Alarm is visible on the network |
| Batch split across two shifts | Shift handover log | Counter zero point | Keeps the running total honest |
| Power loss mid-run | Recovered count value | CAM quantity | Only the controller value is lost |
Edit the right counter, once, before the cycle starts
Set the controller target in MEM or MDI with the spindle stopped, confirm the fixture multiplier, and write the old value on the setup sheet. Ten seconds of discipline beats an hour of recounting parts at the end of a shift.
Frequently asked questions
Does editing the part count change the program itself?
No. The part counter is a register in the controller, separate from the program. The G-code does not change when you edit the target quantity.
What can change is the CAM program if you also edit the setup quantity. That alters nesting, stock, and cycle time, so it produces a different file.
Can I edit the count while the machine is cutting?
Not safely. Most controls ignore the input during automatic operation, and a few will alarm or drop the value. Finish the cycle or stop the spindle first.
If you must stop mid-batch, note the current count before you touch anything, then re-enter it after the edit.
Why does my counter go up by two on a bar-fed lathe?
The program likely ends the cycle twice, once at the main program end and once when a subprogram returns. Check the end blocks and remove the extra cycle-end.
On some lathes the parts catcher cycle also increments the counter. If so, disable that increment or set the target to half the intended piece count.
How do I count pieces when the fixture holds four parts?
Set the controller target to the number of cycles, not the number of pieces. Divide the order quantity by four and round up.
Keep the pieces-per-cycle value on the setup sheet next to the counter. When the order changes, the operator can recalculate in seconds.
Is the part count saved when the machine is powered off?
It depends on the control. Some keep the value in non-volatile memory, some lose it at power off, and some keep it only if the machine was stopped normally.
For long runs, log the count at every shift change. A written number lets you correct the register after a restart instead of guessing.
Can I lock the counter so nobody resets it by accident?
Yes, on most controls. You can protect the setting page with a parameter, a key switch, or a password level. Ask your machine builder which method applies to your model.
Locking helps on long unattended runs. On short runs with frequent setup changes, it usually costs more time than it saves.
Need parts run to a count you can trust?
Send us the drawing and quantity. We quote and return a free DFM analysis within 12 hours, then run from one prototype to 10,000+ parts with 100% inspection before shipment.
12-hour quoteNo minimum order quantity100% inspection