The secondary development technology based on SolidWorks platform
solidworks is a famous fully parameterized 3D solid modeling software developed by American SolidWorks company based on Windows platform. It has powerful functions such as part design, sheet metal design, management design, drawing 2D engineering drawings, supporting remote collaborative work, etc. it can realize the transformation from 3D solid modeling to 2D engineering drawings, and can make part design Assembly design and engineering drawings are fully correlated and synchronized at all times. At the same time, SolidWorks has good openness and compatibility. It can not only be downward compatible with two-dimensional autogad, making the previous design using AutoCAD software continue to be used and transformed, but also seamlessly integrate with many other professional software (such as finite element analysis software ANSYS, data processing software camworks, data management system smarteams, three-dimensional solid design software UG, pro/e, etc.) into a very powerful cad/gae/cam/pdm system, which is fully competent for the design of large-scale projects and products Analysis, manufacturing and data management. At present, all kinds of users are not only applying the powerful functions of SolidWorks for various professional designs, but also constantly exploring the secondary development technology of Solidworks, so as to strive to expand the functions of SolidWorks and make it customized and professional. In this regard, provide some technology worthy of reference
1. SolidWorks' secondary development interface
solidworks' software developers provide API (Application Programming Interface) application programming interface for the convenience of various users' secondary development. It is a programming interface based on OLE automation. This interface provides users with free, open and fully functional development tools, including hundreds of functional functions, These functions provide programmers with direct access to SolidWorks. The functions in API can be called by visual basic, c/c++, VBA or SolidWorks macro files and other development programs that support Ole, so as to expand the functions of SolidWorks. This paper mainly introduces Visual Basic 6, an object-oriented programming language that supports ActiveX technology 0 basic principle and method of secondary development of s sample holder olidworks
2. ActiveX Automation Technology and object hierarchy of SolidWorks
in order to connect their software with other software, most software developers today upgrade their software into a common function that supports ActiveX Automation, and SolidWorks is no exception. SolidWorks' secondary development tools enable users to quickly customize or automate SolidWorks operations by using ActiveX Automation Technology. Using these tools, some standard commands can be modified or added, so that SolidWorks can meet the requirements of users, and a lot of repetitive work can be reduced, so as to save time and improve work efficiency and design quality
(1) ActiveX Automation Technology ActiveX Automation is a technical standard based on COM (Componet Object Model) proposed by Microsoft company, It is the former oli (object Linkin "enterprises should invest more energy and attention in developing high-end products, G and embedding, object connection and embedding) The purpose of the higher-level development of technology is to coordinate different applications under the system management of windows system, allowing these applications to communicate and control each other. Each application can decide what information it can expose. These exposed information can be manipulated by other applications. This program that exposes information is called a server, and the program that manipulates these service programs becomes a client program. ActiveX Automation Technology arranges a dialogue between two programs to achieve the purpose of one program controlling the other program, but this dialogue is not bidirectional, and the two sides of the dialogue are not equal The client program is the application program that starts the request dialog, and the service program is the application program that responds to the client program. ActiveX Automation code runs in the client program, and the actions controlled by these codes are executed by the service program [here SolidWorks is understood as a service program, while VB program as a secondary development tool is regarded as a client program, and the relationship between them is the relationship between server and client. As long as users operate in VB, VB will drive SolidWorks to complete the corresponding work
(2) the virtual hierarchy of SolidWorks the essence of ActiveX Automation is to use the client program to control the object, method and attribute of the service program and realize a certain function. In other words, SolidWorks must expose all ActiveX objects to VB in order to communicate with IR (infrared spectroscopy), DSC (thermal differential scanning analysis) and TGA (thermogravimetric analysis). In this way, VB can manipulate the objects exposed by SolidWorks like its own objects. Objects are simple and abstract representatives of server programs. Objects are generally connected with each other in the form of object model or object hierarchy. No matter what programming language is used to develop SolidWorks externally or internally, it is carried out by calling the object architecture of SolidWorks. The API programming interface of SolidWorks encapsulates all ActiveX objects for programming. The object hierarchy of SolidWorks can be described as a top-down tree structure model (as shown in Figure 1). The root object at the bottom is the s1dworks object, and other objects are its children. The relationship between parent and child objects is not inheritance, but inclusion. In other words, if VB wants to communicate with a specific object of Solidworks, it must first traverse its child objects from Solidworks objects until it finds the specific object. In addition, the SolidWorks object table provided in this article is a summary of all SolidWorks ActiveX objects, in which the arrow symbol indicates that the object also contains sub objects. Due to space limitations, it is not listed here one by one in 2015
3. Specific development method
a simple program example of parameterized drawing of retaining ring parts under sheet metal illustrates how to use VB to carry out secondary development of SolidWorks (mainly using the principle of dimension driving, using VB to drive SolidWorks to dynamically regenerate the retaining ring model according to the parameters input by the user)
sheet metal must first introduce SolidWorks' object library into VB. The specific method is as follows: start VB, create a new project, select the menu "project -> references", select "SolidWorks 2001type library" in "available references", and press "OK". Then establish the "my gear ring" human-computer interaction main control interface (as shown in Figure 2), in which three text boxes are used to input the outer diameter, inner diameter and thickness of the gear ring respectively; " OK "the function of the button is to realize the parameterized drawing of the gear circle with VB driven SOLIDWORKS;" The function of the quit "button is to exit the program and stop drawing. The following are the key codes of parametric drawing of the gear circle and the comments of the main function functions.
itapp: exit the SolidWorks application, release the memory resources
compile and execute all the codes, input the design parameters, press the OK button, and immediately start SolidWorks to draw the three-dimensional gear circle model of any size required by the user.
of course, for drawing the" gear circle " "In such a standard part program, the range of input parameters should be limited to ensure that its drawing parameters comply with the national standard. The program code here does not deal with this problem, but focuses on explaining the communication between VB and SolidWorks.
although this example is simple, it explains how to use VB to develop SolidWorks. It is important that other more complex development work can be carried out on this basis, so as to develop suitable solutions." Specialized software that meets the specific needs of users. In addition, the secondary development of SolidWorks with object-oriented language VB can easily realize the interface with other graphics software (such as the connection with two-dimensional CAD software AutoCAD to realize the combination of two-dimensional drawing and three-dimensional modeling). At the same time, software development based on ActiveX Automation Technology is a hot spot in software development today. This paper is an exploration of the secondary development of SolidWorks based on this technology under this background, It has certain reference value for those who are committed to the secondary development of SolidWorks. (end)