Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: moorea21 on May 03, 2015, 10:08:32 AM

Title: using a variable value directly in gcode
Post by: moorea21 on May 03, 2015, 10:08:32 AM
I'm having no luck executing movement from inside macro files, so I'm looking for an alternative to this macro.

Dim X As Double
X = GetVar(302)
Code "G00 X" & X
End

Is it possible to call up the value of the variable X in this way inside the macro, pass it to the main Gcode file, and then read and execute the 'G00 X &X' command in the Gcode itself, rather than unreliably from inside a macro? Absolute mayhem ensued when I tried more complicated moves from a macro, I'm looking to avoid all 'Code "G...."' statements if at all possible.

If not, would adding
'If IsMoving()
Wend'
before 'End' ensure that this line is executed properly before moving on?

Thanks,
M21
Title: Re: using a variable value directly in gcode
Post by: BR549 on May 03, 2015, 02:40:18 PM
Always use the WHile Ismoving()  / Wend after each single motion call or Group of motion calls.

(;-) TP
Title: Re: using a variable value directly in gcode
Post by: moorea21 on May 03, 2015, 04:24:40 PM
Will do