CNC macro programming - Conditional statements

  Рет қаралды 7,126

Practical Machinist

Practical Machinist

3 жыл бұрын

Let's take a look at how to use conditional statements when CNC programming with G-code macros.
Conditional statements in CNC programming are used when we want to compare two values and act upon the results.
A typical program where we might use a conditional statement would look like this:
IF [#200 EQ 5] GOTO 310
GOTO 20
The statement above tells the CNC machine to go to line 310 (GOTO 310) that if the variable #200 is equal to 5 (our conditional statement) or go to line 20 if the conditional statement is not true.
In order to work, conditional expressions must be enclosed within square brackets, and compare two operands (such as a # variable or a number) through a comparison operator. The example above shows the comparison operator EQ (equal to). Other common comparison operators are:
NE = Not equal to
GT = Greater than
LT = Less than
GE = Greater or equal to
LE = Less than or equal to
To learn more about G-code programming, visit Gcodetutor.com (rb.gy/7yzqfn).
Stay tuned for more machining videos!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Recommended CNC programming books:
Fanuc CNC Custom Macros - amzn.to/370yX0P
CNC Programming Handbook - amzn.to/2MPxT9g
CNC Programming Techniques - amzn.to/3aTS4el
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Practical Machinist is the largest and most engaged metalworking community across the web. With more than 160,000 registered members and 300,000+ social media followers, Practical Machinist is the easiest way to learn new techniques, get answers quickly, and discuss common challenges with your peers. Visit Practical Machinist today to join the community and start connecting with your peers.
Become a Practical Machinist member (www.practicalmachinist.com/)
Like us on Facebook ( / practicalmachinist )
Follow us on Instagram ( / practicalmachinist )
Follow us on Twitter ( / prac_machinist )
Connect with us on LinkedIn ( / practical-machinist )
#Gcode #CNCprogramming #macroprogramming

Пікірлер: 3
@TommiHonkonen
@TommiHonkonen 3 жыл бұрын
this is haas or what base? I use old siemens and damn that is complicated compared to this
@sebastianschwobel5688
@sebastianschwobel5688 3 жыл бұрын
mtd cnc music?
@TommiHonkonen
@TommiHonkonen 3 жыл бұрын
or mtd have practical machinist music (dun dun duuuun)
Tips to Speed Up G-Code Programming
8:27
Practical Machinist
Рет қаралды 2,9 М.
CNC Macro Programming Tutorial: IF Statements
5:33
Practical Machinist
Рет қаралды 15 М.
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 12 МЛН
I'm Excited To see If Kelly Can Meet This Challenge!
00:16
Mini Katana
Рет қаралды 29 МЛН
Unlimited Part Sizes With This Genius Macro Program
11:11
TITANS of CNC MACHINING
Рет қаралды 56 М.
Secret Art of MACRO PROGRAMMING on a CNC Machine | G-Code Genius
12:03
TITANS of CNC MACHINING
Рет қаралды 106 М.
Shorten Your G-Code Using a WHILE Loop! | CNC Macro Programming Tutorial
6:14
CNC Safety Lines Explained
6:34
Practical Machinist
Рет қаралды 6 М.
Cartesian vs. Polar Coordinate Systems | G-code Tutorial
7:09
Practical Machinist
Рет қаралды 6 М.
Use M99 To Loop, Jump, and Return! - Haas Automation Tip of the Day
7:56
Haas Automation, Inc.
Рет қаралды 84 М.
Understanding FANUC Macro B Variables
6:57
Practical Machinist
Рет қаралды 17 М.
Programming CNC Macros - Part 2
19:40
CamInstructor
Рет қаралды 26 М.
Introduction to Canned Cycles
7:44
Practical Machinist
Рет қаралды 22 М.
Bluetooth connected successfully 💯💯
0:16
Blue ice Comedy
Рет қаралды 1,5 МЛН
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 6 МЛН
Лучший браузер!
0:27
Honey Montana
Рет қаралды 1,1 МЛН
Это - iPhone 16!
16:29
Rozetked
Рет қаралды 399 М.