if/while ?

More
15 years 8 months ago #7203 by piasdom
if/while ? was created by piasdom
can i use if or while(or something) to set the depth ?
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.

More
15 years 8 months ago #7205 by BigJohnT
Replied by BigJohnT on topic Re:if/while ?
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.

More
15 years 8 months ago #7207 by andypugh
Replied by andypugh on topic Re:if/while ?
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.

More
15 years 8 months ago - 15 years 8 months ago #7209 by BigJohnT
Replied by BigJohnT on topic Re:if/while ?
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
Last edit: 15 years 8 months ago by BigJohnT.

Please Log in or Create an account to join the conversation.

More
15 years 8 months ago #7210 by piasdom
Replied by piasdom on topic Re:if/while ?
i've read this but couldn't understand what i was reading.(not a program)

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.

More
15 years 8 months ago #7211 by piasdom
Replied by piasdom on topic Re:if/while ?
thanks andypugh, but i can't figure out what goes in the [ ].
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.

Time to create page: 0.201 seconds
Powered by Kunena Forum