Known as one of the Seven Wonders of the World, the Egyptian Pyramids have always been mysterious and have a strong and colorful history in the long history. The external structure of the tower is a quadrangular pyramid structure, which is a very stable structure, and the internal structure is even more breathtaking. There are too many unsolved mysteries in it. Today, the editor will take everyone to use CNC milling to process a pyramid model. It is also a very good decoration to put at home as a decoration.
1. Numerical control mathematics foundation
Before writing a program, we must first learn the basic mathematics for programming. We explain through a functional equation diagram.

As shown in the figure, this is a graph of the coordinate function of XZ. According to the figure, we list the function equation of XZ: Z=-X+A. What this equation expresses is a corner of the pyramid, and we can derive the overall processing method based on its geometric relationship.
In the figure, D is the diameter of the tool; A is the height of the pyramid, which is also half the length of the base; B is the distance between the end of the tool and the tip of the pyramid.
Below we list the position of the tool center according to the function equation (set X1 to any position on the X coordinate):
X=X1+D/2
B=A-Z1=X1
2. Example drawing analysis
After understanding the above mathematical foundation, we can begin to analyze the example drawings. We processed a pyramid shape in a 100X100X60 cube. as the picture shows.

According to the drawings, we analyze and process as follows:
1. Choose an end mill with a diameter of 20;
2. The position of the tool in the X direction X=X1+10;
3. The distance between the tool and the spire B=X1;
4. Take the apex of the pyramid as the origin of the Z-axis coordinate;
Starting from the top of the pyramid, after the tool reaches a cutting point, it cuts a round of squares along the height, and so on, goes down one by one. As shown in the figure, the figure below shows the cutting path of the tool.

Three, write the program
After passing the above mathematical and technological analysis, we write the program as follows:
G0G90G54X0Y0;
M03S800;
M08G43H1Z10;
#1=0;
WHILE[#1LE40]DO1;
#2=#1+10;
G01X#2Y-#2F300;
Z-#1F200;
G01X#2Y#2F300;
X-#2;
Y-#2;
X#2;
#1=#1+0.1;
END1;
G0Z50M09;
M30;
The feed amount of each layer here is 0.1, and you can modify different feeds according to your personal preference.





