Overview
Every ShopMill part program typically starts with a tool-clearance move and ends with a spindle stop, coolant off, table re-home, and rewind-to-start sequence. Typing those lines by hand on every new workpiece is wasteful, error-prone, and inconsistent across operators. The standard fix is a program template: a pre-filled MPF file that contains the agreed header/footer NC code, the work-area clearance moves, and the operator message block. New part files are then created by copying that template rather than starting from an empty file.
How the template is implemented depends on the ShopMill front-end in use. Siemens currently ships three HMI variants for the 810D/840D platform:
- HMI Embedded – typical on 810D Powerline with PCU20 (the case in the source scenario).
- HMI Advanced – PCU50 / PCU70 on 840D Powerline.
- Sinumerik Operate (HMI sl) – PCU50.3 / NCU 7x0.3 and later on 840D sl.
All three can host a template, but the menu path and the file-naming rules differ. The procedure below covers each variant and also documents the related tool-change macro (L6.SPF) technique, which moves the same clearance logic into the tool change itself so that any part program benefits automatically.
Prerequisites
- ShopMill license active on the controller (option bit / CF card slot enabled).
- Operator password level that allows program editing and file management in the NC file system (default:
manufacturerorservice). - Access to the active NC file directory (
MPF,SPF,CMA,WKS) on the CF card or NCU file system. - Knowledge of the active work offset, the fixed machine positions referenced by G75, and the spindle-clearance Z used on the machine.
Reference: The G-Code and M-Code Lines Involved
The header/footer block cited in the field report is built from the following Siemens (DIN 66025) codes. Reference them when building or auditing the template.
| Code | Group | Function | Used For |
|---|---|---|---|
G75 Z0. |
G group 6 (special motion) | Fixed-point approach in Z, position 0 | Header: lift spindle off the part before tool change |
G75 X0. Y0. |
G group 6 | Fixed-point approach in X/Y, position 0 | Header: clear the table before tool change |
G500 |
G group 8 (work offset) | Deselect all settable work offsets (G54–G599) | Footer: return to base machine coordinate system |
G00 X320. |
G group 1 (motion) | Rapid linear interpolation | Footer: park table at the loading-door X position |
M5 |
M misc | Spindle stop | Footer: halt spindle rotation |
M9 |
M misc | Coolant off (all circuits) | Footer: shut off flood + MQL |
M30 |
M misc | Program end with rewind to first block | Footer: close program, reset pointer |
MSG(" … ") |
High-level | Display operator message in HMI | Footer: confirm end-of-program to operator |
M1 |
M misc | Optional stop (active only when OP stop is enabled) | Tool-change macro: pause for proving |
MD20150 $MC_GCODE_DEFAULT_VALUES[75] and the fixed-point positions in MD30600, MD30610, ….Method 1 – Template Workpiece (HMI Embedded / Operate)
Siemens documents a template workpiece feature for the standard HMI: a user-defined NC file that the system uses as the starting content for any newly created program. The official reference is the HMI Embedded / Operate programming manual, entry Siemens Support Entry 55622848 (chapter 6.7.12 in the embedded manual). Behavior is identical between ShopMill and ShopTurn under that entry.
Step-by-Step (HMI Embedded, PCU20)
- On the ShopMill start screen, navigate Program Manager > Templates. If the directory does not exist, create it under
/_N_TEMPLATES_DIRfrom the services area. - Create a new program file named, for example,
_TPL_MPFin the templates directory. Use the underscore-leading naming convention reserved for system templates so the HMI does not display it in the main program list. - Edit the file and paste the header/footer skeleton. Mark the editable region with a ShopMill program-section comment so the operator can locate the part-specific blocks:
;SHOPMILL TEMPLATE v1.0 - DO NOT EDIT HEADER/FOOTER G75 Z0. G75 X0. Y0. ;*** PROGRAM CONTENTS BELOW *** ;*** END PROGRAM CONTENTS *** M5 M9 G75 Z0. G75 Y0. G500 G00 X320. MSG(" *** END PROGRAM *** ") M30 - Save, then exit edit mode.
- From the user area, choose New > Part Program. The HMI will pre-fill the new file with the template body if the controller is configured to do so (see verification step below).
menudir.ini or via the start-up menu. The above template file name still applies, but the assignment is done in Commissioning > Channel.Method 2 – Manual Copy of a Master Program
If the HMI variant does not support template workpieces, or the controller has been locked down to operator level only, the standard shop-floor workaround is to keep a master program in the work directory and copy it for every new part. This works on every ShopMill version, including legacy HMI Embedded PCU20 on 810D Powerline.
- Create the master file once:
MASTER.MPFcontaining the header/footer shown above. - Mark the file as read-only using the file-system attributes from the services area (
SEDIT> file attributes) so operators cannot accidentally edit the master. - Train operators to right-click the master, select Copy, and rename the copy to the part number. The ShopMill editor opens the new file with all of the standard lines already in place.
- Optionally, set the Program Manager default directory so that
MASTER.MPFis always visible in the root of the work area.
This method has the advantage of working on any firmware version and is the fallback when Method 1 is not available. The disadvantage is that operators must remember to copy from the master; a single distracted keystroke creates a blank file and the safety envelope is lost.
Method 3 – Move the Logic into the Tool-Change Macro (L6.SPF)
The field report's author solved the same problem differently: by modifying the tool-change program L6.SPF so that the clearance moves happen before every T-call. This puts the safety envelope in one place that every program (new, legacy, or imported) inherits automatically, and it removes the dependency on operator discipline.
Recommended L6.SPF Skeleton
;L6.SPF - TOOL CHANGE MACRO (rev. 2)
;Moves spindle to clearance Z, sends table to machine zero,
;performs tool change, then resumes the calling program.
G75 Z0. ; lift spindle to fixed clearance point
G75 X0. Y0. ; table to machine zero (clears workpiece)
M1 ; optional stop - active only with OP stop
T=__ ; tool change call (parameter from caller)
M1 ; second optional stop for prove-out
RET
Behavior Notes
- The first
M1pauses after the clearance moves; the second pauses after the tool is in the spindle. With the HMI's Program control / Single block or OP stop on, the operator gets two deliberate confirmations - useful when proving long-cycle programs or when coolant hoses need to be repositioned between tools. - Add a
T0pre-call at the very start of the part program to clear the spindle before the first useful cut, and aT0at the end of the part program so the macro runs one final time after the last tool finishes. This delivers the same header/footer behavior without the operator typing it. - Because L6.SPF executes from the NC kernel, it does not need the part program to be a template. Even hand-edited MPFs or programs imported from CAM inherit the safety envelope.
HMI Variant Comparison
| Feature | HMI Embedded (PCU20) | HMI Advanced (PCU50/PCU70) | Sinumerik Operate (HMI sl) |
|---|---|---|---|
| Template workpiece in NC file system | Supported per channel configuration | Supported per channel configuration | Supported, plus per-template settable frames |
| Menu path to assign template | Start-up > HMI > Template | Start-up > HMI > Template (channel tab) | Start-up > HMI > Templates (operator surface) |
| Recommended location | /_N_TEMPLATES_DIR |
/_N_CMA_DIR/_TPL |
/_N_TEMPLATES_DIR |
| L6.SPF macro editing | Service level only | Service level only | Manufacturer / service level |
| Minimum ShopMill version | 06.04 (typical for 810D PL) | 06.04 / 07.01 | 04.50 + SPxx (HMI sl) |
Verification
After installing a template - by any of the three methods - run the following checks before releasing the change to production:
- New-program test. Create a brand new MPF from the user area. Confirm the header lines (G75 Z0 / G75 X0 Y0) are present and the footer (M5, M9, G500 G00 X320., MSG, M30) is present, in that order.
-
Block search. Use the HMI's Block search with calculation to start the program at the last block before
M30. Confirm the controller computes a valid approach to theMSG(" *** END PROGRAM *** ")block and stops cleanly. A calculation error here usually means the work offset is still active and G500 is missing from the footer. - Tool-change prove-out. With Dry run and OP stop enabled, run a two-tool program. Confirm the spindle lifts to clearance Z and the table moves to machine zero before each tool change. This verifies the L6.SPF modifications if Method 3 is used.
- MSG line test. Cycle the program; verify the HMI message bar shows *** END PROGRAM *** at the end and the channel rewind indicator returns to block 1.
-
Backup. Archive the template file (
_TPL_MPForMASTER.MPF) and the modified L6.SPF to a versioned backup before sign-off. Both files live in CF card paths that are erased on a series start-up if not backed up.
Troubleshooting Matrix
| Symptom | Likely Cause | Fix |
|---|---|---|
| New program created blank; template content missing | Template file not assigned to active channel, or template lives outside the configured template directory | Verify the template path in start-up; ensure the file has the _TPL_ naming convention and read permission |
| G75 Z0 does not move the spindle | MD20150 default for G75 is not set, or fixed-point position 0 in Z is undefined | Set MD20150[75] to a valid fixed-point ID; define the position in MD30600 and follow-up MDs |
| Spindle rotates past M5 because coolant is still on | M9 placed after M30 (unreachable) or missing in footer | Reorder to M5, M9, G500 G00, MSG, M30 |
| Table parks at wrong X position after M30 | Loading-door X coordinate changed after template was written | Update the X value in the master template and re-issue to all copies, or use a settable work offset for the door position |
| L6.SPF modifications have no effect | ShopMill cycle is calling a different tool-change subroutine (e.g., L6 is shadowed by a cycle-internal macro) | Check MD10717 $MN_M_NO_FCT_EOP and the cycle's RESET path; confirm the active tool-change macro by adding a trace MSG("L6 ENTRY") on the first line |
| Operator sees "END PROGRAM" message and machine does not rewind | Program ends with M2 instead of M30 | Standardize the footer to M30; document in operator quick-reference card |
| Template visible in the user program list | File name does not match the system template prefix | Rename to _TPL_… or use a leading dot on file systems that support it |
Best-Practice Notes
- Single source of truth. Choose one of the three methods per machine. Mixing a template file with an L6.SPF rewrite creates two places to maintain and the two can drift when a ShopMill update changes the tool-change cycle.
- Document the footer. Print the footer sequence on a laminated card next to the operator panel. M5 / M9 / G500 / G00 / MSG / M30 is the conventional order; deviating from it confuses service engineers who later audit the NC code.
- Guard the work offset. Always re-issue G500 (or the canonical G54+) at the start and end of a program. A forgotten G500 after a subprogram that left G54 active is the single most common cause of first-cut crashes on a re-run part.
-
Use MSG, not comment lines, for operator messages. A leading-semicolon comment is invisible in the HMI status line; the
MSG(" … ")command is shown until cleared withMSG("")or until a new MSG is issued. - Back up the template before every ShopMill upgrade. The upgrade procedure in Siemens Support 55622848 may reset the template directory if the install is performed at manufacturer level.
FAQ
Does every ShopMill version support a template workpiece?
No. The template-workpiece feature documented in Siemens Support Entry 55622848 is available on HMI Embedded and Sinumerik Operate. HMI Advanced supports a per-channel template file but the assignment is made in the start-up area, not the operator surface. If neither path is available, fall back to copying a read-only master program.
Where should the template file be stored on a PCU20 (810D Powerline)?
Use the system template directory /_N_TEMPLATES_DIR on the active NC file system, with a name prefixed by _TPL_ (for example, _TPL_MPF). The underscore-leading convention keeps the file out of the operator program list and reserves it for the template mechanism.
Is it safe to modify L6.SPF to add clearance moves and M1 stops?
Yes, provided the change is made at service or manufacturer access level, archived to a versioned backup, and tested with dry-run plus OP stop on a two-tool program. The M1 stops remain inactive during normal production unless the operator enables OP stop or single-block, so they impose no cycle-time penalty in production runs.
What is the correct footer line order for a ShopMill program?
The conventional order is M5 (spindle stop), M9 (coolant off), G75 Z0. (lift spindle), G75 Y0. (clear table in Y), G500 G00 X<door>. (deselect offsets, park table at loading door), MSG(" *** END PROGRAM *** ") (operator message), and finally M30 (program end with rewind). Reordering M9 after M30 or placing M30 before the G500 reset will produce a confused end-of-program state.
Why does G75 Z0 sometimes appear to do nothing?
G75 is a fixed-point approach in Siemens DIN 66025: the coordinate after G75 names the machine-defined fixed point, not a destination. If MD20150 $MC_GCODE_DEFAULT_VALUES[75] is empty or the Z fixed point (typically MD30600 and the related fixed-point table) is not defined for the active channel, the block runs as a no-op. Verify the machine data before assuming the template is wrong.