System principle and key technology For NC automatic programming, the main link is to extract the geometric information needed for machining trajectory from CAD graphics, and to sort and optimize the geometric information to obtain a reasonable processing path. Finally, CNC machining technology Get the processing program. There are more internals in AutoCAD two-dimensional graphics. For the graphic entities describing the contours of the parts with specific associated common properties, the following methods can be used: 1) Place the graphic entities describing the contours of the parts on a specific same layer; Set the graphic entities describing the contour of the part to a specific uniform color; 3) specify the graphic entities describing the contour of the part as a specific group; 4) connect the graphic entities describing the contour of the part into a polyline. The result of the comparison of the above methods is very convenient for the irregular curve, and the approximation accuracy can also be adjusted by the approximation algorithm. (3) The straight line segments and the arc segments in the polyline are connected end to end in sequence, with a starting point and an end point, which is convenient for determining the moving direction of the machining tool. (4) Although polyline contains line segments and arcs, it is still a single entity, which is easy to pick and choose. In view of the above considerations, the lines describing the contours of the parts are connected into a polyline. The starting point of the polyline is the starting point of the tool. The coordinates of the end point required during the machining can be determined by the data of the vertices of the polyline. Generate a CNC code. When selecting and determining the entity of the NC code, the function acedEntSel<3> is used first, the prototype is: acedEntSel; this function makes AutoCAD pause, and prompts the user to select the entity in the command line, if it returns RTNORM and get the entity successfully. ADS name. Otherwise return RTERROR. Then use acdbOpenObject to open the selected entity in the graphics database, the function prototype is: acdbOpenObject; finally determine whether the selected entity is. The graphical entity class is often referred to as lightweight Polyline, which allocates memory more efficiently than AcDb2DPolyline. It itself contains many useful functions, such as ArcSegA, tArea, BulgeAt, etc. Using these to easily obtain the data of such graphics, there is the following function <5>: Get the number of nodes of PLINE. StartPoint gets the starting point of PLINE. When generating the NC code, the tool's quick positioning command G00 needs to use the data of the starting point. PointAt obtains the corresponding vertex coordinates according to the specified sequence number. BulgeAt takes the convexity of the arc after the corresponding vertex according to the specified serial number. The crown indicates the degree of curvature of the arc. It is equal to the tangent of a quarter of the angle contained in the arc. Convention in AutoCAD: when the convexity is zero, it means a straight line. When the convexity is positive, it means a counterclockwise arc. If the convexity is negative, it means a clockwise arc. When the absolute value of the convexity is less than 1, the arc angle is less than 180. When the absolute value is greater than 1, the arc wrap angle is greater than 180. Use this function to determine whether the next NC command is the linear interpolation command G01 or the circular interpolation command G02, G03. ArcSegAt obtains the corresponding arc by the specified serial number. The output of this function is AcGeCircArc2d, which is a 2D arc class. By getting this arc, you can use the function of the arc class to get the center coordinates and radius, eliminating the complicated calculation. Output NC Code The NC code of this program is stored in the CString string class and directly generates the NC code file. There are a number of benefits to using the CString class: you can add strings directly to it without worrying about memory allocation issues; you can contact the edit box directly, update its content at any time, and more. An example of automatically generating a numerical control code using a system in a workpiece during processing. The realization of simulation processing is simulated by the virtual machining process before the real CNC machining, and it is necessary to confirm the accuracy of the sequence, the route of the machining route and the arrangement of the tool change. To this end, the system uses the dynamic simulation principle and computer animation technology to develop the virtual machining process. The method used is to generate 3D solid representation tool and blank in AutoCAD, and use Boolean operation to make the tool and blank continuously perform Boolean difference to realize the processing process. The specific method is as follows: <6,7>: 1) respectively define the AcDb3dSolid class pointer representing the blank and the machining tool; 2) call the member function of the AcDb3dSolid class to construct the part blank and the tool; 3) use the 3D geometric transformation to move the tool to the part blank 4) The booleanOper function is called to perform the difference operation to remove the processed part on the part blank; 5) the position of the tool and the part blank is changed by the cyclic structure and the 3D geometric transformation matrix, the difference operation is repeated, and the pattern is regenerated Animate until the finish is complete. To move the tool under the control of the CNC program, the dynamic process of constraining the movement along the specified trajectory at a specified speed is displayed on the computer screen, as long as it is continuously displayed at a sufficiently small time interval, but at the point (xi, Before the display at yi), the image displayed at the point (xi1, yi1) must be erased. The system utilizes the WM_TIMER message sent by the timer in Windows, and the timing can be set by the user. At the same time, a mapping function is set in response to the message, and the image is erased and redrawn by the function. (Finish) Cooling Tower,Manufacturer of Cooling Tower,Industry Water Treatment Cooling Tower Fenghua Jade Motor Co., Ltd. , http://www.chinacoolingtower.com