Object-Oriented Design of CAD Software for Main Drive of Machine Tool

1 Introduction With the advancement of science and technology, the modern manufacturing industry is developing in the direction of high speed, high efficiency, and high precision, and increasingly higher requirements are placed on the structure and performance of machine tools. Therefore, how to adapt to market demand, in the complex and ever-changing market economy, the rapid and high-quality design and manufacture of cutting processing equipment required by the market is the focus of competition in the manufacturing industry. Therefore, applying computer-aided design (CAD) technology to machine tool design has always been the wish of many manufacturers. Most of the previous CAD software was programmed using a process-oriented design method. Inevitably, there were defects such as slow system development, long cycle, high cost, poor software quality, poor readability, reliability, and poor maintainability. With the development and wide application of computer technology, the design methods and methods have also been continuously improved and perfected. Object-oriented methods are attracting people's attention and attention. The object is an abstraction of the basic components of the real world. Each object has its own operating rules (behavior) and internal states (attributes). By analogy, objects with the same or similar attributes and behaviors are abstracted into object classes (generalized). Object classes can also inherit the inheritance mechanism, so that the child object class has the attributes and behaviors of some parent object class, forming a hierarchical structure. ), The combination and interaction of different object classes (implemented by messages) constitute the objective system that we want to study and analyze. The key to object-oriented software development is to establish a unified model—object model, to fully analyze the relationship between objects and objects, and to refine and adjust the analysis model to realize the object-oriented transformation from the conceptual model to the computer model. Finally, the model is implemented in an object-oriented language.

1
Figure 1 The main drive system object model

2 Model establishment According to the object-oriented method, principle and the characteristics of the main drive system of the machine tool, we must first establish the object model of the main drive system. Based on the principle of object division, the entire system consists of the following different object classes, as shown in Figure 1. In the hierarchical structure of the model, the upper and lower object classes have both inclusive and included relationships, as well as inherited and inherited relationships. From top to bottom, the system is gradually refined from the whole to the local and decomposed into easy management and design. Each object class. It is also possible for these objects to derive some subclasses for the base class, making the objects more specific and simple. For example, gears can derive two subclasses, fixed gears and slip gears. In this way, the design of the entire system evolves into the analysis and implementation of the design of each sub-category and the relationship between classes and classes. 3 Model design Based on the object model, we will design each object class in detail, analyze the attributes and methods of each object class, and form the system's conceptual model, using the expression A: {b,c,d,e ,...} means that its meaning is that A has attributes b, c, d, e.... For example: Spindle type: {Shaft end type, bearing configuration type, front bearing diameter, rear bearing diameter, inner hole diameter, gear diameter, spindle span, spindle support type} Fixed gears: {modulus, number of teeth, aperture, Key height, key width, shaft keyway depth, hub keyway depth, type} Bearing class: {bearing type, small diameter, large diameter, width, rated dynamic load, static load rating, minimum diameter installation size, large diameter maximum installation size} Thread Class: {type, thread diameter, trail, middle diameter, length} Node class: {number of child nodes, parent node pointer, child node pointer, data item, drawing mark} Transmission level class: {active tooth number, passive tooth number , number of transmission pairs, stage ratio index, gear ratio, number of parent nodes} ...................................... Where: The node class and the gear stage class belong to the middle design class, used for speed Figure and transmission system diagram. Based on the object model and attribute analysis, these object classes can be expressed in an object-oriented computer language, and the transformation of the conceptual model in reality into the logical model in the computer can be realized, and the algorithm and operating environment mechanism can be finally completed. Software design. 4 System Implementation The entire software design is decomposed into five sub-modules based on the object model and the conceptual model: motion parameter design module, transmission component preliminary calculation module, operation mechanism module, drawing assembly sketch module, and component verification module. Through these five modules, the design of each object is gradually realized, thereby completing the design of the system. This software uses C++ language, the development tool is Visual C++ 6.0, and the running environment is Windows 95/98 or Windows NT. Take fixed gears as an example to illustrate the description of the class. ClassCFixGear //fixed gears
{
Private:
Float modula: // modulus int numberofchishu: // tooth number int innerdiameter: // aperture int jianhigh: // key height ......
Public:
CMainAxisPart(): //Construction function ~CMainAxisPart(): //Destructor void GetXXX(): //Get function of current gear state .....................
Void SetXXX(XXXxxx): //Set the gear status function .....................
Fload CalTouch(): // Calculate the modulus of contact by fatigue strength fLoad CalBend(): // Calculate the modulus of bending fatigue strength int JiaoHe(floadm,intz): //Check the gear void OnDraw(CDCpDC,CPointpoint):/ /Draw gears in display device........................
} The coordination and transfer of data between various classes is achieved through the message mechanism and the structure of Visual C++'s unique document class view class, as shown in Figure 2. From the picture, through these connections, all the object classes that are independent of each other can be organically combined. This structure is low in coupling degree and high in degree of polymerization. The change in one kind of class has little effect on other classes, and only the message changes. The corresponding object has the corresponding response and shows the corresponding form.

1
Figure 2 Relationship between various types of connections

Through the definition of these classes, the realization of functions, and the links between classes, each module in the system can be conveniently implemented and the corresponding CAD software can be rapidly developed. At the same time, the class is inherited, polymorphic, easy to understand and extensible, which makes the developed software easy to maintain, easy to expand functions, code can be reused, system upgrades, modifications become simple and easy. 5 Database design In the design of machine tools, a large amount of data and data need to be consulted. Generally, all of them rely on humans for manual inquiries, which are both tedious and error-prone. In this system, the database data are used to organize and compile these data and data into a database, including the following items: gear tooth number library, gear material library, various types of bearing libraries, thread library, typical spindle component library, and parameter database required for component checking. Wait. The database is implemented using Microsoft SQL Server. The interface between the application program and the database is ODBC technology. Visual C++ support for ODBC is achieved through the CRecordSet class and the CDatabase class. Generating a derived class and a CDatabase instance of a CrecoedSet in an application can be easily, quickly, and securely connected to any ODBC-enabled database. We have developed a more practical lathe main drive CAD system according to the above method, with good trial results.