NEWS
LinuxCNC 2.5.2 Release
There are no translations available.

LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release
There are no translations available.

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
There are no translations available.

New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 

Welcome, Guest
Username: Password: Remember me

TOPIC: if/while ?

if/while ? 15 Фев 2011 04:53 #7203

  • piasdom
  • piasdom's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 537
  • Karma: 2
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 !
The administrator has disabled public write access.

Re:if/while ? 15 Фев 2011 06:39 #7205

  • BigJohnT
  • BigJohnT's Avatar
  • OFFLINE
  • Administrator
  • Posts: 4960
  • Thank you received: 87
  • Karma: 134
You can use do while but there is no if while

www.linuxcnc.org/docview/html/gcode_main.html#r3_2

John
The administrator has disabled public write access.

Re:if/while ? 15 Фев 2011 06:40 #7207

  • andypugh
  • andypugh's Avatar
  • OFFLINE
  • Moderator
  • Posts: 4140
  • Thank you received: 141
  • Karma: 130
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>
The administrator has disabled public write access.

Re:if/while ? 15 Фев 2011 07:07 #7209

  • BigJohnT
  • BigJohnT's Avatar
  • OFFLINE
  • Administrator
  • Posts: 4960
  • Thank you received: 87
  • Karma: 134
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 Фев 2011 07:09 by BigJohnT.
The administrator has disabled public write access.

Re:if/while ? 15 Фев 2011 07:17 #7210

  • piasdom
  • piasdom's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 537
  • Karma: 2
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
The administrator has disabled public write access.

Re:if/while ? 15 Фев 2011 07:26 #7211

  • piasdom
  • piasdom's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 537
  • Karma: 2
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>
The administrator has disabled public write access.
Time to create page: 1.064 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.