Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: djmickyg on March 30, 2024, 12:21:12 PM

Title: passing variables from gcode to macro
Post by: djmickyg on March 30, 2024, 12:21:12 PM
is it possible to send a variable from gcode to a custom m code?

my m code is capturing images from a camera, I want to pass the commanded positions to use in the image file name

thanks
Title: Re: passing variables from gcode to macro
Post by: TPS on March 30, 2024, 12:27:46 PM
from Mach3_V3.x_Macro_Prog_Ref.pdf:

Code: [Select]
'Example:
‘ This macro expects three arguments: P, Q, & R
‘ If put into an M-macro, and invoked via MDI, it will
‘ display the argument values on the status line
‘ For example, if using M1200:
‘ M1200 P1.234 Q2.345 R3.456
‘ Executing the above line to MDI will display:
‘ P=1.234 Q=2.345 R=3.456
Parg = Param1()
Qarg = Param2()
Rarg = Param3()
Message “P=” & Parg & “Q=” & Qarg & “R=” & Rarg
Title: Re: passing variables from gcode to macro
Post by: djmickyg on March 30, 2024, 12:34:52 PM
thanks!!!