Research and development of the most popular CAPP

  • Detail

Research and development of CAPP template customization system


because process design is a highly personalized work, the format of process card varies greatly in different enterprises. Even within an enterprise, in response to the rapid requirements of the market for products, the card format of actual process design often changes. Therefore, it has become an important function of CAPP system and an important research content of computer-aided design to formulate a process card format suitable for enterprises and modify the format of these files conveniently and flexibly with the development of enterprises

1 process template customization system framework

the main body of the whole template customization system is process template management, including the modification of existing templates and the customization of new templates. The system model is shown in Figure 1

from the perspective of realizing the process template customization module, process template customization mainly includes two parts: process card drawing and process card description. Process card drawing involves drawing, capturing and modifying graphics. Corresponding to the process card description part, the system uses XML to describe the process card, and saves the corresponding XML document to the process file library

2 information model of process template

2.1 analysis of process template composition object

template is an abstraction of process file format. Before determining the composition object of the template, we must conduct in-depth analysis of the process card and decompose the elements of the process card

a. static lattice. When the table is set, the content of the static grid is fixed. It does not need to be associated with the process design database. The data is written when customizing the template, and the technologist cannot modify it when preparing the process

b. dynamic lattice. There is only one line of record in the dynamic cell, which is uniquely determined by the "cell attribute", and its content is filled in by the technician during process design. The data in the dynamic lattice needs to be dynamically associated with the tables in the process design database, and the changes of the data are directly reflected in the database

c. cyclic lattice. The data contained in the cycle cell is relatively variable and needs to be associated with the process design database. In the database, two keywords are required to uniquely determine a row of data in the cell. For example, the records of each line in the "work step content" cell in the "process flow card" need to be determined by "cell attribute" and "operation number"

d. object lattice. Object lattice is a special case of dynamic lattice, which contains graphics or other complex data. For example, the cell of "process diagram" in the process diagram is the object cell. Taking the process diagram as an example, the decomposed process template model is given below, as shown in Figure 2

when developing CAPP template customization system, the idea of object-oriented is introduced into the processing of templates. Various elements of templates can be regarded as a series of objects, and the processing of templates is refined into the processing of these objects

2.2 data description of process template

the system uses XML to describe all process cards

xml uses documents to represent entities, and elements in documents represent instances of entities. Every tag in the document is the beginning of a new element (e to create a new growth point lement). An XML element contains a start tag, an end tag, and the content of the element. Based on the process model entity, and various elements of the template can be regarded as a series of instances of the entity, so a set of general XML vocabulary describing the process card table can be designed by using XML technology. On this basis, users can flexibly build the required process document template based on this vocabulary and DTD. After the constructed process template (XML document) is parsed and processed by the table generation engine, it is displayed on the client browser. The system parses the XML document to generate a metadata tree, and then displays it in the form of process cards. There is no real table in the system, and all process cards correspond to XML documents

therefore, the key to template customization is to provide an interactive card drawing function and convert the process cards drawn by users into corresponding XML document descriptions

3 template customization technology based on XML

3.1 creation of template sub elements

through the analysis of template composition objects, template customization is actually a process of decomposing a type of process card format into template sub elements such as static lattice, dynamic lattice, object lattice and circular lattice, and generating them respectively with the help of interactive means. In this system, a template is regarded as an XML document entity, so the process of generating a template is actually the process of creating an XML document, and the new template sub element corresponds to a node of creating an XML document. In order to ensure that the newly created XML document can be parsed by the system, the created XML document must conform to the definition of schema

to create a new document object, you must create a new mdocument instance. The following is the corresponding c++ Code:

ixmldomdocumentptrm_ pXMLDoc;

m_ eateInstance(_T("mdocument"));

after creating the domdocument object, you can set tags for different types of parsing behavior and processing behavior, load the XML document, and create new nodes inside the document to create different template sub elements, so as to generate a complete process card

3.2 drawing process cards

after creating a new template, you can draw process cards on the initial template. When drawing, the system adopts windows graphics device interface (GDI). According to the element decomposition of the process card, the card is composed of a series of cells, so the main work of drawing is the drawing of rectangular boxes

before drawing, you need to obtain the handle of the device description table, in addition to obtaining the information of the device description table, and setting the mapping method of GDI. When drawing, you can select the color and lineweight of the brush, and its coordinate values will be dynamically displayed in the status bar of the interface according to the movement of the brush. In addition, the system also provides the function of "rubber strip", that is, the graphics are displayed dynamically with the movement of the mouse, so that the operation is intuitive

3.3 definition of object attributes of template sub elements

after drawing, the system temporarily saves the graphics on the screen to the linked list, in which the coordinates and other information of the graphics are stored. At this time, the graphic element is not added to the card template, and its attributes must be defined before the graphic element can be saved. When defining the attributes of graphic elements, the system provides the function of picking graphic elements. After a graphic element is selected, corresponding attributes can be assigned to it. The attribute operation method provided by XML comes from ixmldomelement, and its attribute can be set through the setAttribute method of ixmldomelement. Now analyze the attributes of template sub elements:

a. static lattice attribute. The content in the static grid has been determined during the table design. It needs to include the "font" sub element to set the attributes of the text. The attributes of the font sub element include the font name, size, etc

b. dynamic lattice attribute. The contents of the dynamic grid are filled in by the user, rather than completely using petroleum to produce and produce plastic in a wide range. It is necessary to set the layout of the table, which contains fixed grid elements. In order to realize the association with the database, you also need to set the field name attribute and the corresponding database table name. This correspondence can not only realize the direct access of process data in the database during the process, but also lay the foundation for the open management of process data

c. circular lattice attribute. The properties of cyclic lattice are similar to those of dynamic lattice. Because it contains multiple rows of records, you need to set the row and column attributes

d. object lattice attribute. The object grid is a cell for filling in operation diagram or other complex data, and the source of graphics or other complex data needs to be set

e. common attributes of each object. Since each sub element is a series of cells, it contains common attributes such as table coordinate values and alignment. You also need to set the card area attribute of each cell. After defining the attributes of template sub elements, you need to save the results before adding graphic elements to the card template. At this time, we need to adopt the save method of XML: M_ ve(sXMLDocName)。 After saving successfully, the graphical interface will be updated to display the latest card template format

3.4 interactive adjustment of template format

when the template objects are generated, sometimes their format cannot meet the requirements, and a series of adjustments need to be made to them to finally form a well formed process template

a. adjustment of cell position. After selecting the cell to be adjusted, it can be adjusted through the position adjustment function of the system. There are two ways to adjust the position of cells: primary adjustment and precise adjustment. Primary adjustment is to roughly adjust by moving the selected cell. Moving provides a "rubber band" processing method, and dynamically drag the coordinate values, including horizontal and vertical movement values

b. cell size adjustment. Because the cells drawn during card customization are usually drawn arbitrarily, the size of cells is often not accurate enough. The system provides the function of arbitrarily changing the cell size, otherwise it is easy to cause machine failure, personal injury and other dangerous situations, such as equal height, equal width, changing the cell height, changing the cell width and other functions. When the user selects a cell, a dialog box will pop up, and the user can adjust the height or width of the cell by entering a specific value

c. adjustment of field name. Sometimes users need to change the field name of a cell to change its association with the database. As long as you select a cell, the corresponding attribute setting dialog box will pop up, and you can modify the field name of the cell

d. adjustment of static lattice attribute. The adjustment of the static cell content is similar to the adjustment of the field name. As long as you select the static cell to be adjusted, the attribute change dialog box will pop up. You can adjust the cell attributes, including the text, font and alignment of the static cell. To sum up, the user adjusts the size, position and attributes of the generated template sub elements in an interactive way. After adjustment, the template customization is completed. The template customization process is shown in Figure 3

4 conclusion

by decomposing the constituent elements of the process card, the process template is abstracted as an entity composed of static lattice, dynamic lattice, object lattice and circular lattice. With the help of interactive means, the process template is drawn and defined, and the constructed process template is saved as an XML document to complete the loading of template sub elements, so as to realize the customization process of process template. Practice has proved that this interactive template customization technology is of great significance to realize the universality and commercialization of CAPP system. (end)

Copyright © 2011 JIN SHI