Mach4 Advanced M-Code Reference
Chapter 1 : Advanced Macros
M-Code Descriptions
M19 - Spindle Orient
Command Spindle Orient with auto or manual cycle based on parameters
Parameters
S- Angle in degrees of the orientation
M5 or a stop spindle command will cancel the spindle orient
M34 - (Electronically) Gear Two Axes
Achieve electronic gearing between a master axis (Q) and a slave axis (S) at a given ratio (R).
"M34 Q2 S3" Will gear U axis to Z axis.
This M-code requires the "Motion filter" plugin be turned on in order to function
Parameters
Q- AxisID of the "master" axis
S- AxisID of the "slave" axis
R- ratio of <master>:<slave> scale
- a ratio of 1 will be the equivalent of slaving the two motors together in Mach 4
M35 - (Electronically) Ungear Two Axes
Remove the gearing between two (previously) geared axis.
The axis must have been previously geared together using M34.
Parameters
Q- AxisID of the "master" axis
S- AxisID of the "slave" axis
M38 - Turn On SSV (Spindle Speed Variation)
Vary the spindle speed to help with chatter issues while cutting
Parameters
P- RPM to very the speed by
E- Time interval that the speed is varied by
- Time interval that the speed is varied by
M38 is not available on all systems
M39 - Turn Off SSV (Spindle Speed Variation)
Turn off the spindle speed variation
M40 - Gear Change
Commands a spindle gear range change through the machine's gear change routine.
Parameters
P- Gear range number
M91 - Drill Bank 1
Drill bank 1 with Binary T Word for Drills
Parameters
TT Binary Call
M92 - Drill Bank 2
Drill bank 2 with Binary T Word for Drills
Parameters
TT Binary Call
M93 - Drill Bank 3
Drill bank 3 with Binary T Word for Drills
Parameters
TT Binary Call
M94 - Drill Bank 4
Drill bank 4 with Binary T Word for Drills
Parameters
TT Binary Call
M95 - Drill Bank 5
Drill bank 5 with Binary T Word for Drills
Parameters
TT Binary Call
M96 - Drill Bank 6
Drill bank 6 with Binary T Word for Drills
Parameters
TT Binary Call
M100 - Manual Z Move Prompt (Knee Mills)
For two-axis knee mills: shows an operator prompt to move the Z axis by hand, then waits for Cycle Start before continuing.
Parameters
P- Z position to move to (optional)
Q- Type of move (optional)
M103 - Sub Spindle Forward
Turn on the Sub Spindle in the Forward direction
Parameters
SSpindle Speed (optional)
M104 - Sub Spindle Reverse
Turn on the Sub Spindle in the Reverse direction
Parameters
SSpindle Speed (optional)
M105 - Sub Spindle Stop
Turn off the Sub Spindle
M110 - Spindle Activate
Activate the spindle and send it down
Parameters
SSpindle Index
Also accepted
TT101toT105selects spindle 1 to 5, as an alternative toS
M111 - Spindle Deactivate
Deactivate the spindle and send it up
Parameters
SSpindle Index
Also accepted
TT101toT105selects spindle 1 to 5, as an alternative toS
M112 - Dust Cover Open
Open the dust cover
Parameters
SSpindle Index
M113 - Dust Cover Close
Open the dust cover
Parameters
SSpindle Index
M200 – M219: Control Default Outputs:
Turn outputs 0-9 on/off.
Parameters:
--none
Example:
M200 (Output 0 On)
M201 (Output 0 Off)
M202 (Output 1 On)
...
M219 (Output 19 Off)
M220 – Turn on Output:
General macro for turning on any outputs from parameters passed into the M-Code
This allows you to control any of the signals in Mach.
Write to a single output:
--A - Any Output Signal
--S - Output Signal Starting from Output#0
--D - Delay (Optional) ms
Examples:
M220 S2 D2000 (will turn on output signal #2 then wait 2000 ms)
M220 A2 (will turn on output signal #2 “X- lim”)
Parameters A or S must be used but not both at the same time.
Write to multiple outputs using output numbers:
--(Data:"1-10, 63") - Using a GCode Comment on the same line as the M-Code to turn on multiple outputs
--D - Delay (Optional) ms
Example:
M220 D1000 (This is a comment Data:"1-10, 63") turn on Outputs 1 through 10 and 63 and delay 1000ms
Write to multiple outputs using MachMotion Parameter names:
--(Data:{"DriveEnable", "HardwareEnable"}) - Using a GCode Comment on the same line as the M-Code to turn on multiple outputs that are mapped to parameters
--D - Delay (Optional) ms
Example:
M220 D1000 (This is a comment Data:{"DriveEnable", "HardwareEnable"}) turn on the outputs that are mapped to parameters "DriveEnable" and "HardwareEnable" then delay 1000ms
The text entered after "Data:" should be a valid lua table using {} and "" and then remember to close the comment at the end of the line
Also accepted
P- Mach instance number: act on the outputs of another instance
M221 – Turn off Output:
General macro for turning off any outputs from parameters passed into the M-Code
This allows you to control any of the signals in Mach.
Write to a single output:
--A - Any Output Signal (This is typically not used and the "S" value is used instead. The "A" is based on the outputs listed in the configuration, starting at the beginning and counting all the way through.)
--S - Output Signal Starting from Output#0
--D - Delay (Optional) ms
Example:
M221 S2 D2000 (will turn off output signal #2 then wait 2000 ms)
M221 A2 (will turn off output signal #2 “X- lim”)
Parameters A or S must be used but not both at the same time.
Write to multiple outputs using output numbers:
--(Data:"1-10, 63") - Using a GCode Comment on the same line as the M-Code to turn off multiple outputs
--D - Delay (Optional) ms
Example:
M221 D1000 (This is a comment Data:"1-10, 63") turn off Outputs 1 through 10 and 63 and delay 1000ms
Write to multiple outputs using MachMotion Parameter names:
--(Data:{"DriveEnable", "HardareEnable"}) - Using a GCode Comment on the same line as the M-Code to turn off multiple outputs that are mapped to parameters
--D - Delay (Optional) ms
Example:
M221 D1000 (This is a comment Data:{"DriveEnable", "HardareEnable"}) turn off the outputs that are mapped to parameters "DriveEnable" and "HardareEnable" then delay 1000ms
The text entered after "Data:" should be a valid lua table using {} and "" and then remember to close the comment at the end of the line
Also accepted
P- Mach instance number: act on the outputs of another instance
M222 – Wait for input:
This can be used to wait for clamps, doors closed or coolant up to pressure
Wait on Input using Signal numbers:
--A - Any Input Signal (This is typically not used and the "S" value is used instead. The "A" is based on the inputs listed in the configuration, starting at the beginning and counting all the way through.)
--C - Show Cycle Start dialog after timeout with message from signal description or GCode comment
--S - Input Signal Starting from Input#0
--T - Time-out (Optional) in seconds to create Alarm showing the signal description for GCode comment
--I - Invert Logic (Optional) (High Active = 0, Low Active = 1)
Example:
M222 S2 T5 (will wait up to 5 sec for Input#2 to go high.)
M222 A2 I1 (will wait indefinitely for Input Signal #2 to go low. Note, this is not Input#2, but the second input listed in the list of inputs.)
Wait on Input using MachMotion Parameter Names:
--(Data:{"DriveEnable"}) - Using a GCode Comment on the same line as the M-Code to wait on inputs that are mapped to parameters
--T - Time-out (Optional) seconds
--I - Invert Logic (Optional) (High Active = 0, Low Active = 1)
Example:
M222 T5 (Data:{"DriveEnable"}) - Will wait up to 5 sec for the signal that is mapped to "DriveEnable" to go high.
M222 I1 (Data:{"DriveEnable"}) - Will wait indefinitely for the signal that is mapped to "DriveEnable" to go low.
Also accepted
P- Mach instance number: wait on an input of another instance
M223 – Pass Input to pound var:
This can be used along with macro B commands (macro B commands require industrial license to run) to set up logical switch cases or programed safety based on an input on the machine. i.e for running lights out you could have the first line of gcode check for a material verification input and do a M00 stop and wait for an operator if no material present.
Parameters:
--A - Any Input Signal
--S - Input Signal Starting from Input#0
--V - Mach Memory Address
--I - Invert Logic (Optional)
Example:
M223 S2 V500 (Will set #500 to the state of input#2)
IF [#500 EQ 1] GOTO 5 (check for material)
M00 (Stop)
N5
(Run Job)
M30
%
Also accepted
P- Mach instance number: read an input of another instance
(Data:{"ParamName"})- Name the input through the MachMotion parameter it is mapped to, instead of A or S, as for M222
M224 – Pass Output to pound var:
Parameters:
--A - Any Input Signal
--S - Output Signal Starting from Output#0
--V - Mach Memory Address
--I - Invert Logic (Optional)
Example:
M223 S2 V500 (Will set #500 to the state of output signal #2)
M223 A2 V500 (Will set #500 to the inverse of the state of output #2 “x-“)
Also accepted
P- Mach instance number: read an output of another instance
(Data:{"ParamName"})- Name the output through the MachMotion parameter it is mapped to, instead of A or S
M225 – Call PLC Sequence:
By calling M225 in a gcode file you can start a block of user ladder logic in your PLC system. This is used for automation and custom setups
Parameters:
--D = Data to send
--V = Data index
--L = Debugging (logging) default 0
--S = Seq number
--M = Device number (modbus) default 0
Example:
M225 S5 (Start Seq 5 in PLC)
M225 S24 V0 D*PocketNumber (Rotate the tool carousel to pocket PocketNumber. USE WITH EXTREME CAUTION!)
M226 – Wait for PLC Sequence:
Used in conjunction with M225 this allows you to wait for the user ladder logic to signal completion.
Parameters:
--L = Debugging (logging) default 0
--S = Seq number
--M = Device number (modbus) default 0
Example:
M226 S5 (Waits for Seq 5 in PLC to finish)
M227 - Check Signal Mapped to Parameter
Checks whether an input signal is mapped and writes the result to a pound variable. Same function as M252.
Parameters
A- Any input signal
S- Input signal starting from Input#0
V- Pound variable to receive the result
Parameters A or S must be used but not both at the same time.
Also accepted
(Data:{"ParamName"})- Name the signal through the MachMotion parameter it is mapped to, instead of A or S
M228 – GoTo Park Positions:
Easy setup to command the machine to user defined positions. This allows you to use the same code in all your files for tool setter position and then change that position once in one place when you need to move your tool setter.
Parameters:
--P - Position
Or
--(Data:"Name of GoTo Position") - GCode Comment formatted with GoTo position name
Example using "P" Parameter:
M228 P1 (GoTo Tool Change position)
P1 - Tool Change
P2 - Tool Setter
P3 - Part Zero
P4 - Machine Zero
P5 - Park Position
Example using GCode Comment:
M228 (Data:"Park 6")
M228 (Data:"Name of GoTo Position")
M229 - Read OEM Register to Pound Variable
Writes a MachMotion register value to a pound variable. Skipped when M-S-T lock is active.
Parameters
V- Pound variable to receive the value
M230 – Map motor to axis:
--A - AxisID
--M - MotorID
Note: To map multiple motors, just run the macro multiple times with the new motor ID you want to map.
M231 – Un-Map motor from axis:
--A - AxisID
--M – MotorID
Note: "M-1" unmaps all motors on that axis.
M232 – Save, Delete, Restore motor mappings
--S1 Saves the current mapping config
--R1 Restore the last saved motor mapping
--D1 Delete current motor mapping.
M233 – Activate Dual Tables
--T1 Activate Table 1
--T2 Activate Table 2
--T3 Activate Table 3
M235, M236, M237 - Retract Support (internal)
Used by the Retract feature; not intended for use in part programs. M235 stores the auxiliaries that are on at the start of a retract, M236 restores them, and M237 handles the retract-entry GoTo positions.
M238 – Read user fields from the tool table:
General macro for reading the user fields in the tool table and writing them to pound variables
Parameters:
--V = Pound variable used for reading the value from the tool table
--(Data:"SpindleRotation") - Using a G-Code Comment on the same line as the M-Code to pass in the user field name from the tool table
Example:
M238 V550 (Data:"SpindleRotation") - Read user field "SpindleRotation" from tool table and write it to pound variable #550
M239 – Write to user fields in the tool table:
General macro for writing to the user fields in the tool table
Parameters:
--T = Value to be written to tool table
--(Data:"SpindleRotation") - Using a G-Code Comment on the same line as the M-Code to pass in the user field name from the tool table
Or
--I = Amount to add to the current value in the tool table
--(Data:"SpindleRotation") - Using a G-Code Comment on the same line as the M-Code to pass in the user field name from the tool table
Example:
M239 T1 (Data:"SpindleRotation") - Read current value in T parameter and write it to the user field "SpindleRotation"
M239 I1 (Data:"SpindleRotation") - Read current value in T parameter and add it to the current value in user field "SpindleRotation"
M240 – Create GMS Message with GCode Comment
Parameters
- P - Type of GMS Dialog 1 = Alarm, 2 = Notice, 3 = Notification
Also accepted
T- Display time of the notification in seconds; omitted = default
M242 – Read MachMotion OEM Parameter:
General macro for reading MachMotion OEM Parameters and writing them to pound variables
Parameters:
--V = Pound variable used for reading the value from the OEM Parameter
--(Data:"DriveEnableDelay") - Using a G-Code Comment on the same line as the M-Code to pass in the name of the OEM Parameter
Example:
M242 V550 (Data:"DriveEnableDelay") - Read the OEM Parameter and write it to pound variable #550
Any register, not only OEM parameters, can be named in the comment:
(Data:"DriveEnableDelay")- an OEM parameter, as before(Data:"MotionFilter/PathOffset_AvgEngagement")- any register by its Mach path,device/register(Data:{Device="MotionFilter", Register="PathOffset_AvgEngagement"})- the same, spelled out
Example: M242 V550 (Data:"MotionFilter/PathOffset_AvgEngagement") - Read the average engagement of the last cut into #550
Example: M239 T#550 (Data:"AvgEngagement") - then store it in the tool table
M243 – Write to OEM Parameter:
General macro for reading pound variables and writing them to MachMotion OEM Parameters
Parameters:
--T = Value to be written to OEM Parameter
--(Data:"DriveEnableDelay") - Using a G-Code Comment on the same line as the M-Code to pass in the name of the OEM Parameter
Or
--I = Amount to add to the current value in OEM Parameter
--(Data:"DriveEnableDelay") - Using a G-Code Comment on the same line as the M-Code to pass in the name of the OEM Parameter
Example:
M243 T500 (Data:"DriveEnableDelay") - Read current value in T parameter and write it to the OEM Parameter "DriveEnableDelay"
M243 T500 (Data:"DriveEnableDelay") - Read current value in T parameter and add it to the current value in the OEM Parameter "SpindleRotation"
Any register, not only OEM parameters, can be named in the comment:
(Data:"DriveEnableDelay")- an OEM parameter, as before(Data:"MotionFilter/PathOffset_AvgEngagement")- any register by its Mach path,device/register(Data:{Device="MotionFilter", Register="PathOffset_AvgEngagement"})- the same, spelled out
Example: M243 T65 (Data:"MotionFilter/PathOffset_TargetLoad") - Set the path offset target load to 65 percent
Example: M243 I5 (Data:"MotionFilter/PathOffset_TargetLoad") - Add 5 to the current value
M244 - Macro for starting a Reciprocating cycle on OB axis
Parameters
- Q - Axis ID (X = 0)
- A - Position A
- B - Position B
- D - Dwell on ends
- F - Feedrate (units per minute)
M245 - Macro for stopping a Reciprocating cycle on OB axis
Parameters
- Q - Axis ID (X = 0)
- S - S0 or no parameters means stop right away, S1 = Stop on A, S2 - Stop on B, S3 - Stop on A or B
M246 - Positioning OB Axis
General macro for Positioning Out of Band Axes with a Mcode. Has the option to command the axis to move and not wait for it to complete.
Parameters
- Q - Axis ID (X = 0)
- D - Position to move axis to
- E - (Optional) the default is wait for the move to complete. E1 will command and return right away without waiting for the move to finish.
- F - Feedrate (units per minute)
- W - Wait for the current move to complete. This will ignore the position passed to D. (W = 1)
M247 - Getting the position for the nearest rotation for a given angle
General macro for getting the nearest rotation in part coords or machine coords
Parameters
- Q - Axis ID (X = 0)
- A - Angle
- V - Pound Var to return the value to
- E - (Optional) E1 will return part coords E0 or nill will return Machine Coords
Example:
M247 Q(Axis) A(Angle) V(Returned Position) E1 (Part Coords) E0 or nill (Machine Coords)
Also accepted
J- Which rotation:
J0nearest (default),J1next,J2previous
- Which rotation:
P- Position to use instead of reading axis Q; one of Q or P is required
M248 - Read Axis Torque and Write to Pound Var
General macro for reading Axis torque and write to pound var
Parameters
- A - Axis ID (X = 0)
- V - Pound Var used to write the status of GMS warnings to
M249 - Read GMS Warnings
General macro for reading GMS Warning and write state to pound variable
Parameters
-
- V - Pound Var used to write the status of GMS warnings to
M250 Probe Disable Wireless
M251 Probe Enable Wireless
M252 - General macro for checking to see if a signal or I/O is mapped to a parameter
Parameters
(Data:{"ParamName"})- The MachMotion parameter name of the signal to check, in a comment on the same line (required)
M253 - Macro for Moving an OB Rotary Axis at a constant feedrate
Parameters
- Q - Axis ID (X = 0)
- F - Feedrate (units per minute)
- D - Direction (1 = CW, -1 = CCW)
M254 - Macro for Stopping an OB Rotary Axis at a constant feedrate
Parameters
- Q - Axis ID (X = 0)
M256 - Engage Taper Compensation
Engages linear cross-axis taper compensation through the Motion Filter plugin, using the Taper Compensation settings. When the operator arm switch is off this does nothing, so posted programs run unchanged on machines without taper compensation. Waits for the correction ramp to settle before the next line runs.
Parameters
Q- Pair selector: 1 = X slave, 2 = Y slave, 3 = Z slave. Omitted = all configured pairs
P- Pivot position along the master axis, in part coordinates. Written to the settings
R- Amount: slave distance per unit of master travel. Written to the settings
Examples
M256 engages all configured pairs from the stored settings.M256 Q1 R0.005 P0 sets the X pair to 0.005 per unit with the pivot at part zero and engages it.
This M-code requires the "Motion filter" plugin be turned on in order to function
M257 - Disengage Taper Compensation
Ramps the taper compensation to zero and removes it.
Parameters
Q- Pair selector: 1 = X slave, 2 = Y slave, 3 = Z slave. Omitted = all pairs
M258 - Cycle Start Another Instance
Waits for the other Mach instance to be idle, then commands Cycle Start on it.
Parameters
I- Instance number to command
Also accepted
P- Accepted as an alias of
I
- Accepted as an alias of
M259 - MDI Command to Another Instance
Waits for the other Mach instance to be idle, then sends the G-code in the comment to it as an MDI command.
Parameters
P- Instance number to command
(Data:"G-code")- G-code string to send, in a comment on the same line
M260 - Vacuum Zones On / M261 - Vacuum Zones Off (Router)
Switches vacuum zones on or off. The zone selections add up. Words must come after the M-code on the line. M260 starts the pump if it is off and waits until the zones have vacuum; M261 never turns the pump off. Any error (no vacuum settings, an unknown zone, a zone lost while waiting) raises an alarm.
Parameters
A1- The Auto zones
B1- Dual Table: the zones on the active table plus the shared zones
Z1 (Data:"1,3,5") or (Data:"1-4,7")- The zones listed in the comment
T- M260: seconds to wait after switching on zones that have no vacuum check. M261: seconds to wait after switching off
Examples
M260 A1 (Auto zones on, wait for vacuum)M260 Z1 T2.5 (Data:"6") (zone 6 has no vacuum check: on, then wait 2.5 s)M261 Z1 T1 (Data:"2-3") (zones 2 and 3 off, wait 1 s)
M262 - Macro for Sending Label Data to AzureModule(Table Mode)
Send AzureModule label data in the form of lua tables in MCode
Optional: add ["templateId"] to set label template from mcode
--Examples
--M262 (Data: {["_Example1_"]="lorum ipsum","["_Example2_"]="Test2"})
M263 - Macro for Sending Label Data to AzureModule(File Mode)
Send AzureModule label data in the form of a file path to a lua table file and a label id
Optional: add ["templateId"] to set label template from mcode
--Examples
--M262 (Data: {["label_file"]="FULL_FILEPATH","["label_id"]=##})
M266 - Read EtherCAT SDO
Read an SDO (Service Data Object) value from the first motor on the specified axis and store the result in a pound variable. Requires a RapidPath motion controller.
Parameters
Q- Axis index (0=X, 1=Y, 2=Z, 3=A, etc.)
- Reads from the first motor mapped to the specified axis
V- Pound variable number to store the result (e.g. V100 stores in
#100)
- Pound variable number to store the result (e.g. V100 stores in
DATA:{}(in GCode comment)index- SDO index (hex or decimal, e.g.0x2141) — requiredsubindex- SDO subindex (integer, e.g.0) — requiredbytes- Byte count for the read (default:4) — optional
Examples
; Read SDO 0x2141:0 from X-axis motor, store in #100 (2 bytes)
M266 Q0 V100 (DATA:{index=0x2141, subindex=0, bytes=2})
; Read SDO 0x6041:0 from Y-axis motor, store in #200 (default 4 bytes)
M266 Q1 V200 (DATA:{index=0x6041, subindex=0})
; Use the result in GCode
M266 Q0 V100 (DATA:{index=0x6041, subindex=0, bytes=2})
IF #100 == 39 THEN ...
M267 - Write EtherCAT SDO
Write an SDO (Service Data Object) value to all motors on the specified axis. Requires a RapidPath motion controller.
Parameters
Q- Axis index (0=X, 1=Y, 2=Z, 3=A, etc.)
- Writes to all motors mapped to the specified axis
P- Integer value to write to the SDO
DATA:{}(in GCode comment)index- SDO index (hex or decimal, e.g.0x2141) — requiredsubindex- SDO subindex (integer, e.g.0) — requiredbytes- Byte count for the write (default:4) — optional
Examples
; Write value 200 to SDO 0x2141:0 on all X-axis motors (2 bytes)
M267 Q0 P200 (DATA:{index=0x2141, subindex=0, bytes=2})
; Write value 2000 to SDO 0x2141:0 on all Y-axis motors (2 bytes)
M267 Q1 P2000 (DATA:{index=0x2141, subindex=0, bytes=2})
; Write value 1 to SDO 0x6040:0 on Z-axis motors (default 4 bytes)
M267 Q2 P1 (DATA:{index=0x6040, subindex=0})
; Read/Write combination: read statusword, then write controlword
M266 Q0 V100 (DATA:{index=0x6041, subindex=0, bytes=2})
M267 Q0 P6 (DATA:{index=0x6040, subindex=0, bytes=2})
M266 and M267 are only available on systems using a RapidPath motion controller with EtherCAT drives.
M270 - Engage Axis Arm Override / M271 - Release Axis Arm Override (RapidPath)
M270 removes all motors on the axis from the RapidPath multi-axis group and disables their amplifiers, so the axis can be moved by hand while the other axes keep streaming motion. M271 restores them. The override is not persisted across restarts.
Parameters
Q- Axis index (0 = X, 1 = Y, 2 = Z, ...)
Example: M270 Q0 frees the X axis; M271 Q0 takes it back.
M275 - Adaptive Path Offset On
Turns on the Motion Filter plugin's adaptive path offset: a bounded, smooth offset along the path normal in X/Y, or along the Z axis, driven by load feedback (spindle load, an axis load, or a register), used for stone polishing, sanding and similar processes. The offset ramps in smoothly and follows the cut through corners, arcs and back-and-forth strokes, staying on the same side of the part. The feature must be enabled in the Motion Filter configuration. Q selects the direction for the cut (left or right of travel in X/Y, or Z down / Z up) and L the load feedback; both default to the Motion Filter settings when omitted.
Parameters
E- Starting engagement in units, for example the average of the last cut with this tool (see
M276). 0 or omitted = start from the nominal path
- Starting engagement in units, for example the average of the last cut with this tool (see
T- Target load in percent (same units as the load source). Omitted = leave the target unchanged
Q- Offset direction, named as cutter compensation. In X/Y:
Q1= G41, the tool runs on the left of the programmed path so the offset pushes to the right of travel into the material;Q2= G42, tool on the right, offset pushes left. Along the Z axis:Q3Z down,Q4Z up (sanding or polishing with the Z axis). Omitted = the configured mode and side
- Offset direction, named as cutter compensation. In X/Y:
L- Load feedback for this cut:
L1spindle load,L2the registerMotionFilter/PathOffset_LoadInput,L3Z axis load,L4X and Y axis load (weighted by the offset direction). Omitted = the configured load source
- Load feedback for this cut:
Examples: M275 E0.010 T65 Q1 (G41, offset right of travel, spindle load); M275 T40 Q3 L3 (press down with Z, Z axis load)
This M-code requires the "Motion filter" plugin be turned on in order to function
M276 - Adaptive Path Offset Off
Ramps the offset back to zero and waits for it, so the next move starts from the nominal path. The average engagement of the cut is then available in the register MotionFilter/PathOffset_AvgEngagement, and with the V word it is also written to a pound variable, for example to store it in the tool table with M239 and hand it back as E on the next M275 with that tool.
Parameters
V- Pound variable to receive the cut's average engagement in units (optional)
Example
M276 V550 (offset off; #550 = average engagement of the cut)M239 T#550 (Data:"AvgEngagement") (store it in the tool table)
... next cut with this tool:M238 V551 (Data:"AvgEngagement")M275 E#551 Q1
M280 - M284 - Vision Alignment
Camera-based part alignment. Requires the Vision module and a supported camera. The results are applied as modal rotation, scale and shift (G68, G51, G52).
M280begins a run and clears any active rotation, scale or shift.P4four-point rectangle fit (default),P3three-point similarity fit.M281captures one mark at the current position.D1saves the inspection image.M282applies the solved fit. No P = rotation, scale and shift;P1shift only,P2rotation only,P3scale only.M283calibrates the camera.Qknown mark diameter for a single-shot calibration, orCcalibration sheet number to walk a printed sheet. The camera tool must already be active.M284selects the camera's active job.Pjob number; omitted = reapply the saved job.
M900 - Auto Tool Setter Set Tool Length
--Examples
--M900 (Data: "1, 5")
--M900 (Data: "2-5")
--M900 (Data: "6")
M901 - Auto Calculate and Set Tool Setter Position
M902 - Auto Calculate and Set Z Fixture Offset
M903 - Change Auto Tool Setter name
M904 - Performs an action on a DataTracker
Parameters
A- Action:
A0set false,A1set true,A2toggle,A3click
- Action:
(Data:"TrackerName")- The DataTracker to act on, in a comment on the same line
M905 - Lathe Tool Setter: Measure Tool / M906 - Calibrate Setter
M905 measures the current tool in X and/or Z according to its tip direction. M906 calibrates the setter with a master tool according to its calibration mode: in Four Faces mode one face per call, P1 X+, P2 X-, P3 Z+, P4 Z-; in Block Size mode no P, one diagonal pass probes an X face and a Z face.
M910 - M914 - Development and Test Tooling
Used by MachMotion for testing and monitoring; not needed in production programs.
M910starts andM911ends a geometry verification test iteration.(DATA:"path")names the output file.M912analyzes the most recent failed run (placeholder).M913pauses (P1) or resumes (P0) motion point logging.M914sends data to the monitoring system.Kwell-known key index,Vvalue, or(DATA:{[key]=value, ...}).
M920 - Control Profiling/Logging Behavior
This macro allows you to change the state (usually on/off) of an enabled profiling category.
Parameters
- L; the profiling context
- 0: Motion Controller (default)
- C: the profiling category to affect
- 0: Mach 4 core motion data (requires the MotionDataProfiler plugin)
- 100: motion data sent to the motion controller
- 101: motion loop performance data
- 102: motion controller verbose log
- 110-119: motion data sent to the drives
- 110: motor positions, velocities, statuses
- 111: motor positions, velocities, statuses, and other data for probing
- 112: motor positions, velocities, statuses, and other data for homing
- S: the new state for the profiling category
- 0: off
- 1: on
- 2: toggle (default)
- W: how/whether to wait for the state change to take effect
- 0: do not wait, issue the command to change state and return
- 1: wait until the state change is effective
- 2: do not issue the command, but wait until the specified state is effective
(This is usually done
Also accepted
T- Alternate command; mutually exclusive with
S
- Alternate command; mutually exclusive with
M1000 - Mandatory Program Stop Wait for Cycle Start
Parameters
- C - C1 will show the Standard Cycle Start dialog with the text from the GCode Comment
Pauses a program at any point, leaving the spindle running. Any comment provided on the same line will be shown to the customer. The control will not go into an Idle state with this mcode.
M1001 - Optional Program Stop
Pauses the program at any point the same as M1000, if the optional stop switch is turned on. Any comment on the same line will be shown to the customer. The control will not go into an Idle state with this mcode.
Custom M-Codes:
Every machine is a little different and has different functions and options. Custom M-Codes allow the user to create simple programming calls for complex processes, activating or deactivating outputs, reading inputs, performing math, or whatever else the user and machine could require. These M-Codes are programmed in Lua and placed in the macros folder under each profile. Every profile can have its own unique set of M-Codes. The file name must be the macro to be called.
Keywords: MCode, M Code, M-Code
Parameters
CC1shows the standard Cycle Start dialog with the text from the G-code comment, as for M1000
M1002 - Get Value From User
Shows the comment as a prompt with an entry field, waits for Cycle Start, and writes the entered value to a pound variable.
Parameters
V- Pound variable to receive the value (required)
D- Default value (optional)
Example: M1002 V500 D1 (Enter the number of parts)