Using VBA Programming to Find Cold Stamping Pressure Center in AutoCAD

With the increase of cold die design tasks, relying on the original manual method calculation is not only heavy tasks, but also prone to calculation errors. Based on the above situation, the author used VBA programming in AutoCAD2000 to solve the pressure center directly on the drawing, which greatly reduced the designer's work intensity. This method is more accurate than the manual method calculation, and also makes the life of the cold die longer.

I. Overview

The cold die pressure center is the point of action of the punching force. Accurately solving the pressure center is very important for the normal operation of the cold die.

In AutoCAD, the commonly used method of seeking the pressure center is to use the pedit command to edit the punched edge into a polyline, and then offset the small distance to both sides, and use a certain editing method to form a narrow closed area around the punched edge. The region command is edited into a region, and then the AutoCAD Massprop command is used to find the centroid of the region. This centroid is close to the pressure center. For complex blanking parts, the above method is cumbersome to operate, and the editing with Pedit requires that the line and the line must be completely connected (especially when the graphic connection converted from other drawing software is not very good, this effect is more Big). More importantly, every time you solve a stress center, you have to do similar tedious work.

Based on the above reasons, the author uses the most basic and most accurate calculation method, using VBA programming under AutoCAD2000 to solve the pressure center of the die, and then making it into a button, placed on the Inquiry toolbar, you can draw the graphic. Solve the pressure center directly. The basic idea of ​​the program is: first select the primitive object representing the punched edge, and then determine which object is one by one, and then transfer to the calculation processing of the corresponding object. According to the principle of calculation, the pressure center of the object is obtained, and they are treated as an object, and the next object is calculated to find a new pressure center until all objects are processed. The final pressure center is the pressure center of the entire die.

Second, program input and button production

(1) Open AutoCAD2000, select the Visual Basic editor under the Tools menu, and enter the program as a Code.dvb file (the file location is assumed to be D:presscentercode.dvb). See http://?boardid=11 for the complete procedure.

(2) Select the load application under the AutoCAD Tools menu, add the saved Code.dvb file in the Startup suite, and close each dialog box. This project file will be loaded automatically when you start AutoCAD later.

(3) Open the Toolbar dialog box under the View menu, select the Query Toolbar, and the Query Toolbar appears on the interface. Then click the Customize button, the Customize toolbar dialog box appears, select Custom in the Categories item of this dialog box, there will be two blank buttons below, one of which has a small triangle (you can click the mouse to click in front of the small triangle, you can find two buttons ), drag the first blank button (without a small triangle) to the query toolbar, and a blank button appears in the query toolbar. Press the Close button of the Custmize toolbar dialog.

(4) When the Toolbar dialog box is activated, press the right mouse button on the blank button just added, the Button properties dialog box appears, enter the word “pressure center” in the Name field, and enter ^c^c-vbarun D in the Macro field. :/presscenter/code.dvb!ThisDrawing.presscenter (Note: there is a small horizontal line before the vbarun command, followed by a space, in addition, the path must be the path saved by the Code.dvb file, the direction of the reverse slant in the path and the general The path indicates the opposite direction). Click the Edit button, edit the button's drawing, and finally press the Close button, and close each dialog box to complete the button creation. This button works like any other toolbar button at any time when you open AutoCAD.

Third, examples and operations

(1) Draw a multi-male punching member as shown in Fig. 1 in AutoCAD. This workpiece is punched out of five differently shaped holes on a rectangular blank and cut at an angle of 10x45°.

(2) Click on the pressure center button to make the Select objects: prompt, select five holes and 10x45° bevel on the AutoCAD graphical interface according to the prompt (note that the four edges of the outer edge are not selected), press Enter, then automatically The center point of the pressure is out, and its coordinate value is (64, 28.5).

Figure 1 Multi-die punching parts

Fourth, the description

(1) When selecting the punched edge, be careful not to select objects such as the center line, dimension lines, etc. that are not punched edges.

(2) Before selecting the blanking edge, the elements drawn with the polyline, rectangle, and polygon commands must be exploded into separate primitives by Explosion.

(3) The comments in the program can be ignored when the program is entered.

(4) The above program is debugged on Windows2000 and AutoCAD2000. Since it is directly calculated, the result is accurate.

(5) If it is a LAN user, please run it once under the Administrator user and then transfer it to the standard user.

(6) The preliminary work of this method is more complicated (such as program entry, button production, etc.), but the operation of solving the pressure center after completion will be very simple, and the effect is very good in practical applications.

(7) Button production is slightly different under different Autodesk versions, please refer to the related technical materials.

Fifth, the application effect

Due to the large number of sheet metal parts on textile machinery, especially the newly developed glass fiber twisting machine, straight twisting machine and electric spindle double twisting machine of Hubei Yichang Textile Machinery Co., Ltd. are basically composed of sheet metal parts. Therefore, cold die design More and more tasks, relying on the original manual method calculation is not only computationally cumbersome, but also easy to calculate errors. Proofreaders also have to check the calculations. If the verification results are inconsistent, they must be calculated repeatedly. Therefore, the author uses the computer to solve the pressure center directly on the drawing, which greatly reduces the designer's work intensity, and is more accurate than the manual method, which is more beneficial to the life of the cold die. In addition, the button is directly on the toolbar of AUTOCAD. After drawing the picture, it is very convenient to directly select the punching edge to calculate the pressure center. In the practical application of the past two years, good results have been achieved.

Алюминиевая фольга

8011/1235/1100/1145/3003

Luoyang Jinxuan Electronic Technology Co., Ltd. , http://www.jinxuanalu.com