Hello Guest it is April 19, 2024, 12:35:08 PM

Author Topic: macros, Is this the way to do it?  (Read 4087 times)

0 Members and 1 Guest are viewing this topic.

Offline 5ms

*
  •  3 3
    • View Profile
macros, Is this the way to do it?
« 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
Re: macros, Is this the way to do it?
« Reply #1 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.
Re: macros, Is this the way to do it?
« Reply #2 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.  
Re: macros, Is this the way to do it?
« Reply #3 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?

Offline 5ms

*
  •  3 3
    • View Profile
Re: macros, Is this the way to do it?
« Reply #4 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

Offline Dan13

*
  •  1,208 1,208
    • View Profile
    • DY Engineering
Re: macros, Is this the way to do it?
« Reply #5 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

Offline 5ms

*
  •  3 3
    • View Profile
Re: macros, Is this the way to do it?
« Reply #6 on: December 25, 2010, 05:25:46 AM »
moorea21, rrc1962 and Dan

Thank you for your replys and your time