Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: 5ms on December 24, 2010, 02:22:26 PM

Title: macros, Is this the way to do it?
Post by: 5ms on December 24, 2010, 02:22:26 PM
Is this the way to do it?


test.nc
G01 X2 Y0 M101
G01 X9 M101
G01 X14 M101
G01 X15 Y5 M101
G01 X0  Y4 M101
G01 X1 M101
..............   So on..........

M101.m1s
While IsMoving()
  Sleep 10
Wend

   Code “G1 A2.5”
   Code “G1 A0”
   Code “G1 A1.7”
' 101 is dun

5ms
Title: Re: macros, Is this the way to do it?
Post by: moorea21 on December 24, 2010, 03:52:02 PM
I guess so...! See a reply to my post about macro's not being executed in written order, though.
Title: Re: macros, Is this the way to do it?
Post by: rrc1962 on December 24, 2010, 04:00:19 PM
You could use a subroutine right in your G-code.  I don't do it enough to write one from memory, but it's not difficult.  
Title: Re: macros, Is this the way to do it?
Post by: moorea21 on December 24, 2010, 04:07:13 PM
Not heard of a gcode subroutine; would that allow, for instance, 2 commands for an axis on the same line?
Title: Re: macros, Is this the way to do it?
Post by: 5ms on December 24, 2010, 05:35:38 PM
You could use a subroutine right in your G-code.  I don't do it enough to write one from memory, but it's not difficult. 

something like:

test.nc
Sub run101()
While IsMoving()
  Sleep 10
Wend

   Code “G1 A2.5”
   Code “G1 A0”
   Code “G1 A1.7”
end sub

G01 X2 Y0 run101
G01 X9 run101
G01 X14 run101
G01 X15 Y5 run101
G01 X0  Y4 run101
G01 X1 run101

Title: Re: macros, Is this the way to do it?
Post by: Dan13 on December 25, 2010, 01:18:12 AM
You can use a subroutine right in the G code, like this:

test.nc
G01 X2 Y0
M98 P101
G01 X9
M98 P101
G01 X14
M98 P101
G01 X15 Y5
M98 P101
G01 X0  Y4
M98 P101
G01 X1
M98 P101
M30

O101
G1 A2.5
G1 A0
G1 A1.7
M99

Read the manual for more details.

Dan
Title: Re: macros, Is this the way to do it?
Post by: 5ms on December 25, 2010, 05:25:46 AM
moorea21, rrc1962 and Dan

Thank you for your replys and your time