Design and implementation of automatic generation

  • Detail

Design and implementation of automatic drawing generation system

1 Introduction

with the continuous development of CAD basic theory and application technology, the functional requirements of CAD system are becoming higher and higher. Designers are no longer only satisfied with the use of CAD system to achieve the purpose of "throwing plates". Instead, I hope it can essentially reduce a lot of simple and cumbersome work, so that they can focus on those creative high-level thinking activities

in engineering design, there are often many models of a kind of products, and the new model products inherit the existing products in spatial structure Their geometric and topological structures are consistent, but there are differences in size, proportion, technical requirements and so on. Because it has a lot in common with existing products, the drawings of new models are often modified and adjusted on the basis of existing drawings of similar products. Even so, this is still a very cumbersome work, inefficient and error prone

in order to uniquely and definitely describe the engineering design object, Almost any "Engineering CAD drawing, such as replacing the rubber sheet, contains not only various graphic elements that describe the geometric topology information of the object, but also non geometric information that describes the specific size, geometric tolerance and upper and lower deviation of the drawing, and describes the technical requirements and notes of the specific application of the drawing object. It is the non geometric information (text information) in the drawing." Make CAD graphics have specific engineering significance, and really play a link role in engineering design exchange and information exchange. Therefore, for the same series of products with the same spatial topology, the geometric information in the drawing can be reused, while for non geometric information, the data in the database can be reflected on the drawing by matching them with the fields in the database one by one

2 definition of parent drawing

definition L (variable): elements that may change in the drawings of the same series of products are called variables

variables are usually text information such as dimensions, geometric tolerances, technical requirements, parts list content and title block content. The argument can be regarded as in the drawing Formal parameter ". The corresponding relationship between the drawing and the database field ("actual parameter") can be established through arguments

definition 2 (parent graph): a parent graph is a drawing that identifies variables, defines variable constraints, and provides necessary information as a template

through the master drawing, the geometric information of the same series of product drawings can be reused. It is the template of the same series of product drawings. Through identification in the parent graph, the variables have different characteristics from other elements. Ordinary elements in the drawing have no extended attributes You can distinguish between arguments and ordinary elements by whether there are extended attributes or not

each part of the product is not isolated There is an interdependent or restrictive relationship between them, so the elements in the drawing also have corresponding constraints. Constraints in drawings include geometric constraints and dimensional constraints. Geometric constraints refer to the implicit conditions of graphics, such as horizontal parallel and vertical lines, tangent lines and circles, and so on. They do not change in the process of dimension driving; Dimensional constraints refer to the interaction and dependence between the distance, included angle, radius, graph and other parts of a graphic element (between). When generating drawings, the graphic elements in the drawings of the same series of products are unchanged, so only dimensional constraints need to be considered when defining the parent drawing. Dimensional constraints reflected in the parent graph are variable constraints

3 database construction

in the automatic drawing generation system, all the requirements for generating drawings are directly from the database. The database is not only the medium and buffer between users and the system, but also can conveniently manage the generated drawings, making it possible to separate the generation of drawings from the drawing system of CAD software

3.1 master map library design

the generation of each drawing is inseparable from the master map and argument value. A product may have several master maps, so the master map library must have three types of data tables: product table, master chart and argument table. Because the variables of various products are different, and the structure of its corresponding argument table is also different, each product table has an argument table corresponding to it

the field structure of each data table in the master map library is roughly as follows (for visual enlightenment, each table has been greatly simplified. Fields ending with "#" represent primary keys, and fields ending with "#" represent foreign keys)

product table design: (product number #, product name, argument table name, constraint library name, deletion flag, status,...)

parent chart design: {parent chart number #, parent chart name. Product number *. Parent chart, user, update time, version, side division mark, status,...).

argument table design: (product model #, product number *, version, update time, user, status, outer diameter, inner diameter, roughness,...)

The outer diameter, inner diameter and roughness in the argument table refer to the name of the argument. It changes according to the specified argument name, and its number will increase or decrease with the increase or decrease of the number of arguments. The argument table is created or updated when the first parent drawing library of the product is created

during the design process, the parent drawing may be changed The drawing of a certain type of product may also be changed. In order to make the operation reversible and traceable, it is necessary to record the version of the data, the operator, the operating environment and other information. When different users conduct the argument table of a certain type of product at the same time, there will be conflicts. In order to prevent conflicts, set a status flag in each record of the argument table. If a user is changing the drawing of the product, set the corresponding record to the outbound state. In the outbound state, the record cannot be changed, so as to ensure the integrity of the data

cad graphics are vector basin graphics, and usually the parent graphics are very small; CAD drawing files usually have a high compression ratio and can be compressed and stored on the parent drawing. In the database management system, the maximum number of fields in a data table is limited. If the number of variables in a parent graph exceeds the maximum number of fields in the data table, we should consider increasing the number of variable tables corresponding to the product

3.2 constraint library design

according to the actual needs, the original graphics may be modified in the graphics drawing process, but it is not enough to modify only the basic argument values. In order to maintain the consistency and integrity of product graphic data, some elements must be solved by constraints. The constraint set rules are designed in this system to automatically calculate the elongation after fracture of the sample, so that the graphic database system can realize the consistent update of the relevant variables of the whole product when the values of some variables change. In order to retain the drawing constraint information, the system designs the corresponding constraint library to retain the constraints of some variables

constraint Library: (constraint number #, product number *, constraint flag number, constraint condition, status,...) The constraint here is an expression, which conforms to the rules agreed in advance by the system and represents various constraint relationships between elements. In order to solve the constraint expression, the system also sets an analytical function, which can analyze and obtain the corresponding argument information for different constraints

for some common constraints, the system establishes constraint expressions respectively. If the constraint expression with equal two arguments is equal (D1, D2), D1 and D2 are known two arguments. In order to analyze the constraint expression, a special matching analytic function is established in the system. Corresponding to equal (D1, D2), what the parsing function does is to parse DL and D2 respectively, then extract the data of DL and D2, and finally change the argument table according to the specific conditions of constraints

the establishment of the master drawing database enables the system to save the necessary graphic information and basic parameter information for generating new drawings; With the establishment of constraint database, users can establish specific constraints according to the actual situation, activate the corresponding constraints when users input data to the argument table through programs or by using the trigger mechanism of the database, and automatically review or modify specific argument values

4 implementation of the system

caxa electronic drawing board is an excellent representative and well-known brand with independent intellectual property software in the field of manufacturing informatization cad/cam/plm in China, and it is also the CAD software with the highest market share in China. Taking CAXA electronic drawing board as the platform to realize the automatic drawing generation system is of great practical significance

4.1 the parent diagram establishment module

identification argument can add extended attributes to the elements in the drawing through the ebseieextenddata function in the secondary development interface ebads (electronic board application development system), and its corresponding function ebgetextenddata can obtain extended attributes. It is necessary to clearly identify whether the element has set an extended attribute, so it is necessary to set another extended attribute, whose value is a cuid (global unique identifier) character. The cuid string can ensure no repetition in the sense of probability

identifying variables is an important work of creating parent graphs, which can be achieved in two ways

1. Immediate menu mode. Immediately, a series of interrelated menus guide the user to complete the operation step by step. The content of the later menu is determined by the previous item, so that the user can complete most of the drawings with only the mouse, reducing the dependence on the keyboard. When defining variables in this way, the step flag message transmission mechanism provided by the secondary development of CAXA electronic drawing board is used to realize various operations on the selected elements on the immediate menu

2. Batch processing method. Extract all text information in the drawing into a table at a time, and add extended attributes to the text elements to be defined as arguments. Text without an extended attribute is not an argument and will not be saved to the database. Only text with a name set can become dynamic data

before identifying the variables, all blocks containing text elements in the drawing should be broken up, and the multi-layer nested blocks should be broken up until all text elements are independent, because the text in the block cannot be modified, and the parent graph is the template used to generate a new drawing. When generating a new drawing, the value of each variable should be changed to the corresponding value in the argument table. The extended attribute of each argument must have a name. The names of arguments in a parent graph should be unique

after the variables are identified, the constraints are defined according to the established constraint expression methods and rules, and its seed and parent graph are coexisted in the parent graph of the database, and the constraint relationship of the parent graph is activated when the data is recorded or changed

4.2 data input interface

when generating drawings and defining parent drawings, the system transmits or exchanges data with the background database. Of the new drawing to be generated "Arguments" are stored in the database. These data should be entered into the database by the user. Two types of data grabbing interfaces can be realized: first, the user can find the argument values of drawings one by one. This method is suitable for the situation of less generation and drawings, and can be realized by adding some functions on the basis of grid controls. Second, batch input, which can be directly imported from files in formats such as excd files and CSV, or from fixed separated text files. The data files of these batch children are usually generated by automated software

4.3 drawing generation module

when generating drawings, first download the parent map saved in the database to the local storage area, and then assign all the arguments in the parent map with the argument values in the argument table one by one. The process of assigning a value to an argument is to replace the initial value of the argument in the parent graph with the value of the argument. This process requires modifying the text element in the drawing

Copyright © 2011 JIN SHI