CNC turning simulation using VC++ programming (3)

Dynamic trajectory display: All the coordinates obtained by linear interpolation are displayed in order to obtain the trajectory of the tool tip. In order to distinguish different tool trajectories, different colors are used to indicate fast feed, straight cut and circular cut, as shown in Fig. 2 is an actual trajectory simulation screen.

The trajectory simulation process has a small amount of data, and the performance requirements of the computer are not high, and it is simple and convenient. However, the actual cutting process reflected is not comprehensive, especially the interference of the tool to the workpiece during the cutting process cannot be reflected. The dynamic simulation of the part cutting process can directly display the geometry between the tool and the workpiece, and can simulate the cutting process of the part. It is not only more vivid, but also can deal with the interference phenomenon during the cutting process.

The dynamic simulation grammar of the cutting process is basically the same as the simulation algorithm of the tool trajectory. It is also through three processes, the following aspects are different:

Take the tool: Take the tool number as the mark to the tool database, extract the tool parameters and draw on the screen.

Tool movement: In the simulation, the movement of the tool is realized by the computer dynamic display technology. In the program design, the tool graphic is drawn at each track point where the tool passes, so that the entire track line will be filled with tools. In order to visually display the movement of the tool, there are two simple and commonly used methods: one is the “paint-wipe-paint” method. The basic principle is that the tool is erased every time the tool moves, and the new tool is drawn. Tool graphics, this method is only suitable for simple graphics, the disadvantage is that the non-moving part of the graphics superimposed on the graphics will also be wiped off. The second method is to use the "exclusive OR" display mode to draw, that is, the graphic at the position is XORed with the image of the previous position and then displayed, and the loop generates a dynamic graphic. This method not only makes the code compact, but also has no effect on the part of the picture that is still. This program uses this method, which makes the tool produce motion and the workpiece does not move.

Achieve the cutting of the material on the workpiece: draw the shape of the blank of the part, and simulate the appearance of the material on the blank by cutting the knife on the screen. This is an important part of the machining simulation. The basic method implemented in software is to repaint the cut parts. When painted in the same color as the background, the visual is cut by the tool. The specific implementation method is to define a small area as a color filling area at the tool tip portion of the tool. In this way, in the cutting motion of the tool, along with the cutting command, the area through which the shaded portion of the tool passes becomes the background color, realizing the dynamic simulation of the cutting process.

Previous page

Shower Faucet Set

Tub Shower Faucet,Shower Faucet Set,Tub And Shower Faucets,Shower And Tub Faucet Sets

AIHUI Sanitary Ware , https://www.aihuisanitary.com