The hottest method and practice of cadcapp integra

  • Detail

Method practice of cad/capp integration

the basis of cad/capp/cam integration is to establish a unified product definition model. The practice in recent years shows that feature-based modeling technology is becoming one of the most effective modeling methods to implement the integration of cad/capp/cam. Traditional CAD systems can only provide geometric models of products. Therefore, how to convert geometric models into feature models has become the key to cad/capp/cam integration. There are two ways to realize this model, interactive feature definition and feature recognition, said Zhang Xin. The former adopts human-computer interaction, and the obtained feature model has high reliability, but the input is time-consuming and the practical efficiency is low. The latter has a high degree of automation and is difficult to realize. This paper realizes cad/capp integration by parsing DXF drawing file format

I. DXF file format analysis

dxf file is composed of five parts: Title segment, table segment, block segment, entity segment and file end segment, and its content is as follows

☆ header header header records the current value or current state of all header variables in AutoCAD system. The Title Variable records the current working environment of AutoCAD system, such as snap capture current state, grid spacing style, current layer name, linetype, color, etc

☆ the tables table section contains four tables that can optimize the growth and development of plants, and each table also contains variable table items. The order in which these tables appear in the file is linetype table (Ltype), layer table (layer), typeface table (style), and view table (view)

☆ block block segment records the block name of the block used, the current layer name, the type of block mediation, troubleshooting and upgrading with the economic tension of people such as aerospace, national defense, kerosene chemical industry, transportation, etc., the insertion base point of the block, and all members of the block. The types of blocks are divided into graphic blocks, blocks with attributes and nameless blocks. The nameless block includes the section line generated by hatch command and the dimension standard completed by dim command

☆ entities entity segment records the name, layer, name, linetype, color, etc. of each entity

☆ EOF of file is the end flag of DXF file

a DXF file consists of several groups, each of which occupies two lines. The first line is the code of the group, and the second line is the value of the group. The group code is equivalent to the code of data type, which is specified by the CAD graphics system, and the group value is a specific value. The combination of the two represents the meaning and value of a data. For example, code 10 represents the X coordinate of a point, accounting for one line, and its second line 4.5425 is the specific value of the X coordinate of the point. The combination of the two represents a point, and its X coordinate value is 4.5425

(1) the type of group code and group value. The group code is a non negative integer with no more than three digits, and the group value is determined by the type of group code. For example:

code 0 ~ 9 group value type is character type

code 10 ~ 59 group value type is real

code 60 ~ 79 group value type is integer


code 999 represents the interpretation line

(2) the meaning of group codes. Each group code has a specified meaning. Some codes have fixed meanings, while some group codes have multiple meanings due to different applications, which should be analyzed in detail. In addition, some codes are standby and have not been used in the current version. Here are some examples of their meanings

0: indicates the beginning of a thing, such as a block, table, layer, entity, etc

1: the value of character data, such as text string, file name, attribute value, etc

2: the name of an object, such as the name of a segment, table, block, linetype, view, etc

3 ~ 5: the value of character data, such as file name, linetype description, etc

6: linetype name (fixed type)

8: layer name (fixed type)

the use of entity coordinates and corresponding group codes 10 ~ 18, 20 ~ 28, 30 ~ 38 should be used in the order of 0, 1, 2,... Of the individual bits of the group code according to the number of points used by the entity. For example, the starting point group codes of line are 10, 20 and 30, while 11, 21 and 31 are its ending points. Other similar

The structure of DXF file is quite complex, and reading DXF file completely is also an extremely tedious project. In practical application, in order to extract the entity information of the drawing, many items in the DXF file can be omitted. As long as the layer table, block segment and entity segment are obtained, the description of the corresponding geometry can be completed. The color and linetype of each layer are described in the layer table, the layer and attribute of the block and its position in the drawing are described in the block segment, and the geometric information such as the starting point and end point of the line, the center and radius of the circle and the layer of each entity are described in the entity segment. According to the layer of the entity, search the layer table for the color and linetype of each layer and add them to the entity object. When drawing with CAD, the variable parameter dimaso needs to be set to on to ensure that the size block defined in the block segment is a whole and can be obtained correctly. According to whether the dimension type name, the start and end coordinates of the dimension definition match the entity type name and the entity space coordinates, the dimension of the entity object is attached. When drawing, for example, the user-defined roughness, geometric tolerance and other blocks are not exploded, and their attributes can also be extracted by adding corresponding reading functions

the format of entity segment in DXF file is illustrated below

arc (ARC)

0 (start) arc (ARC)

8 (group code of layer)

w1 (layer name "W1")

10 (x coordinate group code of arc center)

7.0 (x coordinate group value of arc center)

20 (Y coordinate group code of arc center)

9.0 (Y coordinate group value of arc center)

30 (Z coordinate group code of arc center)

0.0 (Z coordinate group value of arc center)

40 (radius group code of arc)

25.0 (radius value of arc)

50 (starting angle group code of arc)

90.0 (starting angle value of arc)

51 (ending angle group code of arc)

180.0 (ending angle group value of arc)

if the line type of the entity uses bylayer, the color is 256 (that is, bylayer), and the base height and thickness are zero, the format can be simplified

the format descriptions of other graphic entities (line, circle, text, etc.) are not detailed here

II. Extraction of geometry entity information

to generate DXF files, you must first enter the graphics environment, type dxfout at the command prompt, and answer a required file name, that is, convert the graphics data in internal compressed format into ASC Ⅱ data and write it into the corresponding DXF file (with DXF as the extension) for the application program to extract and process entity data

third, the data structure of geometric description

by analyzing the DXF graphics exchange file of CAD system, all geometric elements describing parts can be obtained. In order to simplify the problem, it is set that the graphic elements constituting the inner and outer contour of the part only include points, lines and arcs, which are represented by the following data structures respectively

point: class point {float X; float y; float Z;} Virtual base class: class shape{//lines and arcs are derived from the virtual base class to facilitate linked list operations public:

virtual void showentity() =0;//indicates that this function must be defined in the derived class...//other virtual functions are defined here} lines: class line:public shape, Public point{public://line class is derived from two base classes, shape and point. Point start_point;//line start point point end_point;//line end point...//define other internal variables and functions here} arc: class arc:public shape, Public point{public://arc class is derived from two base classes, shape and point. Point center_point;//arc center point start_point;//arc start point end_point;//arc end float radius;//arc radius...//define other internal variables and functions here} node: struct node//define nodes to facilitate internal deletion in the linked list, Add and modify {shape *item;//content field node *llin. Let's first understand the specific function of the lower fixture K;//left pointer node *rlink;//right pointer} linked list: class list {//linked list class private:

node *head;//knot pointer public:

list();//construct function numbers, initialize variables void ~ list();//destructor, free memory void addentity (shape *) ;//Define the function of adding graphic elements...//define other functions here} therefore, it is not difficult to store the geometric elements of rotating parts in a linear linked list with the above data structure. A complete feature recognition system includes not only geometric information, but also processing technology information, which is not provided by the commonly used geometric modeling CAD system. Therefore, we define a set of process information blocks in AutoCAD system, which are all stored in the form of graphic file blocks. These information include: shape tolerance (straightness, flatness, roundness, cylindricity, line profile and surface profile), position tolerance (parallelism, verticality, inclination, coaxiality, symmetry, position, circular runout and total runout), surface roughness and datum, etc

IV. summary

this paper first introduces the structure of DXF file, analyzes the meaning of group value and group code, then explains the method of reading DXF file, and finally briefly introduces the data structure of realizing this function module. This method has achieved good results in the cad/capp integrated system of rotating parts

Copyright © 2011 JIN SHI