if/while ?
i want to cut at a certain depth(ie. .1") at a time till a finish depth(say .788).
been working on Owords, very fun. i usually cut pockets in aluminum.
thanks for any help !
Please Log in or Create an account to join the conversation.
www.linuxcnc.org/docview/html/gcode_main.html#r3_2
John
Please Log in or Create an account to join the conversation.
#1 = .778
#2 = 0
#3 = 0.01
O100 DO
#2 = [#2 - #3]
G1 Z#2
<G-Code goes here>
O100 WHILE [#2 GT #1]
<finishing pass at Z = #1>
Please Log in or Create an account to join the conversation.
Here is one from the ID subroutine.
o100 while [#<Current-Diameter> lt #<Final_Dia>]
O101 if [#<Current-Diameter> + #<Depth_Cut> lt #<Final_Dia>]
#<Current-Diameter> = [#<Current-Diameter> + #<Depth_Cut>]
O101 else
#<Current-Diameter> = #<Final_Dia>
O101 endif
X#<Current-Diameter>
G1 Z#<Z_EndOfCut> F#<FeedRate>
G0 X[#<Current-Diameter>-0.010]
Z#<Z_StartOfCut>
o100 endwhile
John
Please Log in or Create an account to join the conversation.
BigJohnT wrote:
You can use do while but there is no if while
www.linuxcnc.org/docview/html/gcode_main.html#r3_2
John
Please Log in or Create an account to join the conversation.
i understand #2 = [#2 - #3] equaling -.01, so it would move down .01 each pass(or run of code)?
but no idea what [#2 GT #1].
i'm guessing GT is GoTo. what does the While ? xy or z?
<G-Code goes here> where is the "While" telling Z to do anything ?
that D### z. thanks for your help !
andypugh wrote:
Yes, that is pretty much what the functions are for
#1 = .778
#2 = 0
#3 = 0.01
O100 DO
#2 = [#2 - #3]
G1 Z#2
<G-Code goes here>
O100 WHILE [#2 GT #1]
<finishing pass at Z = #1>
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
but now you threw in "if" and "lt" (guessing "less than")
i understand that "if "this" is "less than" "that" do something.
but i can't see where it(while) knows to move xy or z.
Thanks again !
BigJohnT wrote:
There are quite a few examples in the subroutines section of the do while loop.
Here is one from the ID subroutine.
o100 while [#<Current-Diameter> lt #<Final_Dia>]
O101 if [#<Current-Diameter> + #<Depth_Cut> lt #<Final_Dia>]
#<Current-Diameter> = [#<Current-Diameter> + #<Depth_Cut>]
O101 else
#<Current-Diameter> = #<Final_Dia>
O101 endif
X#<Current-Diameter>
G1 Z#<Z_EndOfCut> F#<FeedRate>
G0 X[#<Current-Diameter>-0.010]
Z#<Z_StartOfCut>
o100 endwhile
John
Please Log in or Create an account to join the conversation.
G0 X[3 + 5]
would send the X axis to X8
John
Please Log in or Create an account to join the conversation.
www.linuxcnc.org/docview/html/gcode_over...html#sub:Expressions
The basic syntax of a while loop is:
while test is true
do code between while and endwhile
endwhile
So when the while test evaluates to false jump to the endwhile line. and carry on without executing any code between while and endwhile.
John
Please Log in or Create an account to join the conversation.