How to use Mathematical Equation to Write NC Macro Program
Paycnc.com - PAY for CNC components
How to use Mathematical Equation to Write NC Macro Program
 When you learn this trick, you will find that writing CNC programs is as easy as filling in the blanks.
 
Today, I use this trick to solve the number of milling and machining of star-shaped parts.
 
The following diagram:




How to write a program?
 
Two steps:
The first step: set variables into the equation
Arbitrarily set several variables:

#1 stands for X
#2 stands for Y
#3 represents the angle θ

Enter the equation as follows:
#1=30*COS[#3] *COS[#3] *COS[#3]
#2=30*SIN[#3] *SIN[#3] *SIN[#3]
 
Step 2: Use equations to calculate coordinate points
 
How to calculate?
Answer: The increment and decrement of variables
 
Here I directly copy the structure of the previous number-car variable auto-increment statement and make a slight modification as follows:
  .....
#3=0
N1#1=30*COS[#3]*COS[#3] *COS[#3]
#2=30*SIN[#3] *SIN[#3]*SIN[#3]
G1X#1Y#2F200
#3=#3+0.1
IF [#3LT360]GOTO1
In minutes, the programming of this curve part is completed.
The program simulation is as follows:





With the finishing program, how to write the roughing program?
 
Of course, the fastest way is not to write the code one by one, but to copy. Just like the above program, I directly copied the program for counting cars in the previous article. After replacing the equations, in minutes, it is another program for counting and milling. .
 
I still use the "copy" method and directly upload the roughing program for your reference.
 
TOP
Message Us