Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: whistule on March 26, 2016, 08:30:35 AM

Title: Passing variables into a macro
Post by: whistule on March 26, 2016, 08:30:35 AM
Hi All,

I am looking for a little advice on how best to go about inserting a variable into a macro.  This is a peck drilling application with rapid feed as created by Mick Grant  [ Melee ]  and posted on this forum in 2009 [ http://www.machsupport.com/forum/index.php/topic,15205.0.html ] .  The code I'm looking to execute is below but I can't get the variable [in this case #4] to pass through to the macro.  It seems the solution may have something to do with getvar(), but I haven't been able to find any simple examples of this in operation - so I can't work out which which code to add and where.  A copy of the m830 Macro is attached.  If I replace the #4 with -10 on N50 then the program and macro runs excellently - credit to Mick Grant - so i do know its the insertion of a variable like #4 that's throwing a spanner in the works.      Any help or pointers most appreciated.       

#4=-10

%
N10   G20 G18 G80 G90 G94
N11   G28
N12   T202
N20   G0 X0 Z10
N30   M03 S600
N40   G90
N50   ;M830 X0 Y0 Z#4 R2 Q2.5 W0.5 P5 D3 F100 I0 J0 L1
N60   M830 P50
N70   G80
N80   G90
N90   G0 X0 Z10
N100   M5
N120   M30
%