In the modeling process, the system uses the Visual C6.0 language to encode, and uses the standard graphical interface to achieve support for OpenGL. Due to the good portability of OpenGL, especially in combination with VisualC object-oriented programming software, the MFC class library is used as the interface between OpenGL and Windows, and the dynamic link library is compiled to enhance the ability of other application calls. Developed graphics software that not only has a three-dimensional effect, but also provides good interactive functions, so that the graphics effects can be directly controlled. Therefore, the development of the system uses OpenGL to implement the virtual reality interface.

Using OpenGL to build a 3D model of a CNC machining system. Using GDI for Windows to call the corresponding function through the device description table (DC); similar to OpenGL drawing, OpenGL function is to complete the rendering of 3D graphics through the rendering description table (RC). . The window and device description table under Windows supports the bitmap format attribute, which is consistent with the RC structure of the bitmap. As long as the RC is connected to a DC when creating the RC, the OpenGL function can be drawn to the corresponding display device via the DC corresponding to the RC.

After the above analysis, the steps to establish a simulation model based on OpenGL with Visual C are as follows: Create a project file NCSystem, including header files and function library files gl\gl.h, gl\glu.h, gl\glaux.h, opengl32.lib, Glu32.lib, glaux.lib file.

The custom return type BOOL protected member function bSetupPixelFormat sets the pixel format and calls it in the OnCreate function in the View class. Define the Protected member function Init whose return type is void, create a coloring description table and initialize the coloring description table. After the execution is completed, use the OnDestroy function in the View class to delete the coloring description table and the device description table bound to the coloring description table. . Init is called in the OnCreate function, so that the OpenGL kernel is notified that the pixel format and coloring description table have been correctly created and managed effectively. Add cs.style|=WS_CLIPCHILDREN|WS_CLIPSIBLINGS to the PreCreateWindows function. Next edit the program in the Init function to get the size of the client area, eliminate the depth cache, start the depth test, and start the OpenGL model transformation. Call the custom DrawScene function in the OnDraw function in the View class to complete the model drawing. Use the SwapBuffers function to exchange the content display models in the two caches.

In this way, a visual simulation model framework for NC machining based on OpenGL standard is constructed. The function and design main interface completed by the main interface are divided into three areas: the dynamic display area of ​​the data, the dynamic display area of ​​the track, and the display area of ​​the processing program. The dynamic display area of ​​the data includes the workpiece coordinates and machine coordinate values, the relative coordinate value display of each machining segment, and the display of the tool number, spindle speed, and feed speed during machining. From the main interface, directly enter the machine adjustment interface, NC code editing and compilation interface, automatic processing interface, system parameter setting interface.

Conclusion In the VC development environment, a standard program framework based on OpenGL is built, which realizes the simulation system of CNC machining and milling movement, shortens the development cycle, saves money, and builds a visual test platform for new research methods and theories. It can be used as a manufacturing unit tool in virtual manufacturing to realize digital production of products. At the same time, the system has the following characteristics: (1) portability: although it is developed on the WindowsXP platform, it uses OpenGL to generate graphics, which is independent of the window system and operating system, so it is very convenient to transplant between various platforms; 2) Authenticity: Due to the use of solid modeling, combined with a series of special treatments such as illumination, texture, color, etc., the simulation processing environment is closer to reality; (3) Easy development: the use of OpenGL reduces the programming amount of system graphics, development Without having to master a large amount of graphics knowledge, you can concentrate on mastering difficult algorithmic problems.

(Finish)

Light Keel Roll Forming Machine

Metal Roofing Machine,Light Keel Roll Forming Machine,Light Keel Roll Forming Making Machine,Light Keel Steel Roll Forming Machine

HEBEI SENUF MINMETALS CO. LTD , https://www.senufmachine.com