Hello Guest it is May 14, 2024, 04:15:51 PM

Author Topic: passing variables from gcode to macro  (Read 145 times)

0 Members and 1 Guest are viewing this topic.

passing variables from gcode to macro
« 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

Offline TPS

*
  •  2,506 2,506
    • View Profile
Re: passing variables from gcode to macro
« Reply #1 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
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: passing variables from gcode to macro
« Reply #2 on: March 30, 2024, 12:34:52 PM »
thanks!!!