Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: widpyro on November 27, 2011, 09:00:15 PM
-
Can someone post sample code for calling a subroutine? I would also want to quantify the number of times it repeats. Is it just a matter of typing m98 and then following it with my subroutine, and then adding L ## for the number of times it repeats, and then ending it with M99?
Thanks,
-jim
-
http://www.machsupport.com/forum/index.php/topic,20119.0.html
(;-) TP
-
I cannot get a subroutine to run. I want to have the subroutine within the code. Please write me a complete example of a code with a subroutine. I need to know the order that everything should be in the code.
thanks,
-jim
-
Here you go
G80 G90 G55 G20
#1=3
F1
G0 X0Y0Z0
M98 P1 L5
M30
o01
G01 X#1 F50
Y#1
X0
Y0
#1=[#1+2]
M99
%
(;-) TP
-
Thankyou! That works for me.
-jim
-
In general programming ( I use dbase 4 ver 2) it is possible to create a loop
which will stop when a variable reaches a certaim value.
It looks like this
x-1
do while x < 10
(do something)
x = x+1
enddo
(it will go through the loop until x= 10 and then jump out to the line
following the "enddo"
Is something like this available in Mach3 gcode??
where can i find something about it
many thanks
fred evans from south africa
-
NOT with MACH3 it does NOT do conditional Gcode.
What you would need to do with MACH3 is do the DEPTH value/ step depth then round UP to the next whole number. NOW this does mean you will have to start eh process HIGH to account for the roundup.
IE: Depth of 10.5mm / 1mm = 10.5 steps RU to 11. NOW figure 11x1mm = 11mm , 11mm-10.5 = .5 So you would start the process .5mm high to get to the proper depth with 11 steps.
Then just apply that to the Gcode M98 P?? L11
Hope that helps, (;-) TP
(;-) TP