ShopDocs · Glossary Definition

Macro

A macro in CNC is a control-side program that uses variables, arithmetic, and logic to automate repetitive or parameter-driven machining tasks instead of hard-coding every move. It allows a single routine to handle different part sizes by passing values at call time, reducing programming effort and centralizing logic for family-of-parts work.

On the shop floor, macros are used for parametric programming—writing one master routine that accepts inputs like diameter, pitch, or bolt count at call time. This allows the same macro to machine a family of parts with minimal edits. For example, a CNC cell might use a macro to prompt an operator for a pocket depth, calculate step-downs, adjust tool offsets, and execute the cut path automatically. Macros also incorporate error-checking logic to validate user inputs, preventing crashes from wrong values. In production environments, macros improve repeatability across multiple shifts by automating setup sequences and reducing manual entry mistakes. They replace hard-coded toolpaths with flexible, reusable code, making them ideal for recurring jobs like bolt circles, pocket patterns, or custom fixtures where dimensions vary slightly.

Operational Failure Matrix
Risk LevelOperational Pitfall Description
⚠️ Warning 1An incorrectly mapped variable or offset sends the cutter to the wrong position, producing a feature that is dimensionally correct but functionally scrap.
⚠️ Warning 2A macro that accepts user input without bounds checking can drive the tool too deep or into a fixture when an operator keys in the wrong value.
⚠️ Warning 3Macro programming is not enabled on every control, and dialects differ by manufacturer; using unsupported commands can stop the program or cause unintended motion.
Technical FAQs
What makes a macro different from standard G-code?

A macro adds variables, math, conditional logic, and looping, while standard G-code is mostly a fixed sequence of motion and machine commands.

When should a shop use a macro instead of a subprogram?

Use a macro when the routine must change based on inputs, measurements, or part size; use a simple subprogram when the motion is repetitive but does not need calculations or decision-making.

Why are macros common in family-of-parts work?

Because one validated program can handle multiple sizes or configurations by changing a few parameters, which improves consistency and reduces rewrite time across recurring jobs.

Software that works like your best tools.

This Glossary is maintained by Ryxen — focused software tools that solve specific operational friction points for Canadian small businesses. No ERP bloat, no per-user pricing, no demo calls.