Graphical automatic programming of CNC wire cutting 3B machining instructions

Abstract Based on Auto CAD as a platform, a graphical automatic programming system for CNC wire cutting 3B processing instruction was developed. It uses AutoLisp language to read the group code data of graphic entities, processing and processing is 3B code. Practice has proved that the method is intuitive, accurate and efficient. High, simple operation.
Keywords graphic solid line cutting entity code

A CNC wire-cutting machine is a machine that uses a molybdenum wire moving up and down to perform EDM cutting of metal. For decades, there have been many series of wire-cutting machine tools in the world, and the corresponding processing instructions have also achieved international ISO and EIA standards. Domestic wire-cutting machine tools have been widely used throughout the country because of their low price, easy maintenance, good reliability, and high number of skilled operators. However, domestic machine tools are widely used 3B format processing instructions. General graphical programming systems (such as UGII, MasterCAM, etc.) can only generate processing code that conforms to ISO and EIA standards and cannot do anything about 3B format codes. In recent years, Auto CAD has been widely used in the domestic machinery industry. This paper develops a 3B instruction graphical automatic programming system on Auto CAD. It adopts AutoLisp language to read entity group code data to transform into 3B processing code. Practice has proved that it is accurate, practical and efficient.

1 Principle

1.1 3B instruction code format format: B XY B YY B J G Z
Where B is the delimiter. XY and YY: 1 When machining a straight line, it is the end point coordinate of the straight line (the origin is at the starting point of the straight line); 2 When machining an arc, it is the starting point coordinate (the origin is at the center of the arc). J and G: G is the counting direction, there are X, Y two directions, respectively Gx and Gy, as shown in Figure 1, for the straight line, when the line is in the shaded area, G takes Gy, otherwise G takes Gx; The end of the round orphan is in the shaded area, G takes Gx, otherwise it takes Gy. J is the sum of the projected line length or projected length of the processing path (straight line or arc) in the counting direction; Z is the processing instruction, and there are 12 types (see Figure 2).
1.2 Auto CAD Entity Selection Sets and Entity Group Codes In Auto CAD, each graphic element can be treated as a separate entity. The ssget() function can also be used to construct the required entity selection set. Each entity's data can be found by looking up its entity group code. Each entity has an entity name, represented by a group code -1, and an entity type such as Line, Arc, Pline, etc., represented by a group code 0. Other group code relationships are shown in the following table.

1

Figure 1 Counting direction selection (left is straight line, right is arc)

1

Figure 2 Schematic of machining instructions (left is straight, right is arc)

The following is a section of entity group code:
(-1.<Entity name:>)
(0."LINE")
(8."0")
(10 1.0 2.0 0.0)
(11 6.0 6.0 0.0)

Table part code

Group code Straight arc 8 Layer name 10 Starting point coordinate Center coordinate 11 End point coordinate......... 40 ......... Radius 50 ......... Starting angle 51 ......... End angle 210 Extension direction Extension direction

2 Programming Method

The program first calls the gettfiled() function to create an NC file (this file has the .3B extension), and then uses the ssget() function to define the entity selection set (selected by the user according to the processing sequence), which is then broken into "Line" and "Arc" two types (research found that for v12.0, graphics entities are broken to the end Line and Arc, such as fitting Fit pline broken Arc, spline fitting pline broken line Etc.) So the core of the program is line and Arc. The program transfers to the next entity to determine whether it is a line or an arc. After the stream is split, the geometric data is extracted according to the line or Arc's group code, and a string "B XX B YY BJGZ" is formed to add the line to the NC file. Go in, and then call in an entity for loop calculation, so that the NC file will increase line by line until the entity is edited.
For a straight line, you can use 10 and 11 group codes to extract the start and end coordinates, and then change the origin to the starting point. At this time, XX and YY are the end point coordinates. Let dx1 and dx2 be the absolute values ​​of XX and YY, respectively. Then, when dx1>dy1, G=Gx and J=dx1. Otherwise, G=Gy and J=dy1. For arcs, the center, radius, start angle, and end angle can be extracted by 10, 40, 50, 51 group codes. One of the problems with arcs is the calculation of the projection length J, as shown in FIG.
The J calculation of the arc is divided into 3 cases (Fig. 3) for 1J = |Qx-Zhx| or J = |Qy-Zhy| (Q: start point, Zh: end point). For 2 the origin is moved to point Q where J=|Qx+Zhx| or J=|Qy+Zhy|. Calculate Q1A' and Q2B' for 3 to move the origin to Q1 and Q2, respectively: Q1A'=|Qx| or |Qy|, Q2B'=
|Zhx| or |Zhy|, then J=Q1A'+Q2B'+D.

Fig. 3 Calculation of arc projection length J (when G=Gx for the left and G=Gy for the right)

For the machining direction of the arc (swivel, counterclockwise), since the group code data of the Auot CAD arc is all defined counterclockwise, the program will retain the coordinates of the last entity point and assign it to the variable ZhD. The next entity is an arc, then the ZhD is compared with the starting point coordinates of the arc Qx,y. If the same description indicates that the arc is counterclockwise, otherwise the arc is clockwise, and the arc start point and the end point are exchanged. The block diagram is shown in Figure 4.

1

3 Conclusion

Practice has proved that using the method described in this article to compile the 3B processing code, the operation is simple and rapid, the calculation is accurate, intuitive and reliable, the effect is significant, the requirements for the numerical control programmer are reduced, the difficulty of labor is reduced, and the 3B processing code is graphically achieved. The purpose of automatic programming.