PRIME MOTION— Help
Search

Tools, Macros, Wizards & History › Macros

Macros

A macro is a few lines of G-code saved under a name, so a routine you repeat is one tap: probe down to a surface, park the machine, warm the spindle up. Macros lists them by category; tap Run and the lines are sent to the controller.

Macros waits until the machine is ready to work; see the homing gate. The position readout stays at the top so you can watch what a macro does.

The Macros tab: the Hidden, Import and New buttons, then the macros by category, each with Run
The Macros tab: the Hidden, Import and New buttons, then the macros by category, each with Run

The list

Macros are grouped under Setup & Probing, Machine Management, Programming & Geometry, Safety & Logic and Custom. Each row shows the macro's name, a Lua badge for a script, how many parameters it takes (such as 2 params) and its description. G-code macros have Run; scripts have Test; see Scripts.

A row's ⋮ offers Edit and Delete for your own macros, and Hide or Show for every macro. Hidden in the header shows hidden macros, dimmed, so you can bring them back.

The built-in macros

CategoryMacroSends
Setup & ProbingProbe Z DownOne probing move down (G38.2 Z-), up to the probe distance
Probe X+, Probe X-, Probe Y+, Probe Y-One probing move in that direction
Probe Corner (XYZ)Z down, then X, then Y, each followed by a short retract
Machine ManagementHome All Axes$H
Unlock Alarm$X
Check Mode Toggle$C — the controller reads lines without moving, or stops doing so
Programming & GeometrySet Work Zero (All Axes)Sets G54's zero at the current position
Set Work Zero X, … Y, … ZSets one axis of G54's zero
Go to Work ZeroG0 X0 Y0, then G0 Z0
Safety & LogicSoft Reset, Feed Hold, Cycle ResumeThe controller's reset, hold and resume

The probing macros ask for a Probe distance and a Feed rate (25 mm and 100 mm/min by default).

Four more G-code samples are included: Spindle warm-up ramp, Park and cool down, Blow chips before a tool change and Stop everything on an alarm. Read each one's lines before running it on your machine.

Running a macro

Tap Run. A macro with no parameters, whose every line is decided in advance, runs at once. Otherwise a Run name drawer asks for Values, shows the pre-flight check, and waits for Run.

The Run drawer for a probing macro: the Values, the pre-flight check, and Cancel and Run
The Run drawer for a probing macro: the Values, the pre-flight check, and Cancel and Run

While it runs, Running: name shows the line it is on and a Cancel button, which stops the macro. It ends with Macro Completed (and the time it took), Macro Failed with the line that failed, or Macro cancelled.

A macro is refused while a program is streaming, and a line that would move or power an unhomed machine is refused with the reason.

The pre-flight check

Before anything is sent, Prime Motion reads every line of the macro and says what it will do:

Pre-flight saysMeaning
Fixed N linesEvery byte of those lines is decided now
Deferred noneNothing waits on the machine; the whole macro is decided before the first line goes
Deferred N linesThose lines depend on a value read from the machine at the moment they are sent, and say which
Needs a valueA parameter has no value yet
Refused N linesThose lines would be refused; nothing will be sent, and each refused line says why

Run waits until the pre-flight check is ready.

Writing your own

New opens New Macro:

  • Name, Category (Setup, Machine, Program, Safety, Custom) and an optional Description.
  • Body — the G-code, one command per line.
  • Parameters — Add a parameter for each value you want to be asked for: a name and a default. In the body, #1 is the first parameter, #2 the second, and so on.

The pre-flight check updates as you type. Create saves the macro once it has a name and a body.

G21 G91
G0 Z#1
G90

A macro that raises Z by the first parameter, in millimetres, relative to where it is.

Import brings in .nc and .lua files from a folder on the tablet; see Scripts.

Still stuck? Contact support or email support@primemotioncnc.com.