Arithmetic & Functions

Do trigonometry in a macro and know that Fanuc works in degrees.

Macro math uses square brackets, and trig is in degrees — not radians. COS[30] is 0.866, not what a calculator in radian mode would tell you.

Read firstMacro ArithmeticReference for CNC macro arithmetic operations including addition, multiplication, trigonometric functions, and logical operations.

Your turn

The machine hands you a radius in #101 and an angle in degrees in #120. Compute the point on the circle at that angle: #121 = the X distance, #122 = the Y distance.

The machine gives you

40 mm radius at 30°:#101 = 40#120 = 30
25 mm radius at 60°:#101 = 25#120 = 60

Your program is run once for each set of conditions. It has to work for all of them.

Loading...

This is a learning simulation — always prove out a program on the actual control before you cut metal.