Using web grammar to recognize dimensions in engineering drawings

Using web grammar to recognize dimensions in engineering drawings

0031 3203/93 $6.00+.00 Pergamon Press Ltd ~) 1993 Pattern Recognition Society Pattern Recoonition, Vol. 26, No. 9, pp. 1407 1416, 1993 Printed in Gre...

644KB Sizes 1 Downloads 66 Views

0031 3203/93 $6.00+.00 Pergamon Press Ltd ~) 1993 Pattern Recognition Society

Pattern Recoonition, Vol. 26, No. 9, pp. 1407 1416, 1993 Printed in Great Britain

USING WEB GRAMMAR TO RECOGNIZE DIMENSIONS IN ENGINEERING DRAWINGS WEIDONG MIN, ZESHENGTANG and LONG TANG CAD Center, Department of Computer Science and Technology, Tsinghua University, Beijing 100084, People's Republic of China (Received 6 May 1992; in revised form 9 December 1992; received for publication 16 December 1992)

Abstract--A web grammar based on arrowhead-match is described in detail and used to recognize dimensions in machine engineeringdrawings. Accordingto the national standard GB4458-84of People's Republic of China, the dimensions are classifiedinto 27 patterns and 48 subpatterns whose mathematical descriptions are given. The concept of arrowhead-match is presented and 9 arrowhead-match patterns are summarized. Based on this web grammar, an algorithm for recognizing dimensions is implemented in C on a HP workstation, which can recognize 27 dimension patterns and 48 dimension subpatterns mentioned above. Dimension

Web grammar

Recognition

Pattern

l. INTRODUCTION Engineering drawings are both the core part of technical documentation and the most complex component of the documentation in the integrated C A D system. Many of the paper machine drawings are still active and operational, and there is a demand for a fast and reliable means to transform them to digital information, which can readily be incorporated as a part of CAE database management systems. Therefore, it has been a main research topic of CAD to input engineering drawings into computer automatically so that the computer can store, manage, maintain and modify these drawings rapidly and effectively. An intelligent automatic engineering drawings input system must have scene analysis capability, i.e. both visual capability to perceive the scene and intelligence to interpret it properly. However, most accomplishments on automatic engineering drawings input technology are more or less confined to a drawing copying machine, which can recognize some simple geometry primitives such as line, arc and character, and store an output vector graph that is nearly the same as the original engineering drawing. They have not recognized the intrinsic logical relations in engineering drawings in spite of its ability to save data storing memory. When a trained human looks at a machine drawing, he visualizes the two-dimensional (2D) shape of each of the object's projections by classifying the lines into either annotation or geometry of the object. While such a classification is usually trivial for people, it is hard for automatic systems, as object and interpretation lines are frequently interleaved in a manner that makes their classification possible only by analyzing their context, or relations with other lines. Engineering drawings are created (either by human or computer driven plotters) using a methodology which is more or less strictly defined by a certain standard. This suggests

Arrowhead-match

that any reasonable solution should involve some kind of syntactic analysis. Recognizing and understanding engineering drawings means not only recognizing geometry primitives (such as lines, characters), distinguishingthe annotation part, but also recognizing logical relations between geometry primitives and the annotation part. Furthermore, it means reconstructing a 3D model from orthogonal views or reconstructing a 2.5D model from a single orthograph. Therefore, recognizing and understanding the annotation message, namely dimensions, in an engineering drawing is a prerequisite for the development of recognizing and understanding engineering drawings. Some approaches on recognizing and understanding engineering drawings have been achieved by Haralick !~ and Dori. t2'31 Haralick's research was confined to 3D reconstruction and does not include how to distinguish logical relations from an image scanned from an engineering drawing. Dori presented the fundamental method for recognition of engineering drawings which starts with arrowhead detection, including the definition of dimension components with a set l ) = {C, W, S, L, A, T}, the concept of symmetry and regularity of dimensions and the classification of dimensions on a functional basis. Dori also made use of both a 4-tuple (72q~r/) to describe attributes of line components of dimension and a web grammar with seven rewriting rules to describe dimensions. However, he has not shown the way to identify the matching property of arrowheads whereas this is the basis to execute his algorithm. In this sense, his algorithm had a gulf between theoretic research and practical implementation. This paper presents a web grammar based on arrowhead-match to solve this problem. In order to deal with practical engineering drawings in People's Republic of China, all our research is in accordance with the People's Republic of China national standard GB4458-84 for

1407

W. MIN et al.

1408

machine engineering drawings. ~4~ In Section 2, components, kind, and types of dimensions are defined and discussed. Based on both morphological and functional classifications of dimension, dimensions are classified into 27 patterns and 48 subpatterns whose mathematical descriptions are given. Then in Section 3, after the concept of arrowhead-match has been presented, 9 arrowhead-match patterns are summarized. Section 4 shows 22 rewriting rules of dimension's web grammar based on 9 arrowhead-match patterns. In Section 5, an algorithm based on this web grammar has been implemented in C on a HP workstation, which can recognize 27 dimension patterns and 48 subpatterns mentioned above. Some results are demonstrated. Finally, a summary and conclusion is given in Section 6. 2. COMPONENTS,CLASSIFICATIONSAND PATTERNSOF DIMENSION

2.1. Components of dimension The dimension set consists of six components: C (contour), W (witness), S (shape), L (tail), A (arrowhead) and T (text), denoted as f~ = {C, W, S, L, A, T}. 12'3) A simple example is shown in Fig. 1. A chamfer dimension consists of only L, T and C (see Fig. 2). 2.2. Classifications of dimension In order to deal with practical engineering drawings in People's Republic of China, we classify dimensions according to the national standard GB4458-84 of People's Republic of China. Dimensions that can be recognized by this algorithm are classified on a functional basis into seven types. We denote the set of longitudinal, angular, circular, diametric, radial, screw and chamfer types of dimensions by A = {L, A, C, D, R, M, F}, as shown in Fig. 3.

T

/ 2x45

L x,x 3 ~j

Fig. 2. Components of chamfer dimension.

A dimension is complete if it is characterized by two arrowheads; otherwise it is incomplete. Incomplete type dimensions include R type dimension, truncated circular dimension (abbreviated as EC) and truncated diametric dimension (abbreviated as ED). EC and ED type dimensions are shown in Fig. 4. Based on symmetry and regularity defined by Dori, (2"3) the dimensions may be distinguished as four kinds: regular symmetric (abbreviated as RS), regular asymmetric (abbreviated as RA), irregular symmetric (abbreviated as IS) and irregular asymmetric (abbreviated as IA), see Fig. 5. 2.3. Twenty-seven patterns and 48 subpatterns of dimension Apart from ED, EC and F type dimensions, each of the L, A, C, D, R, M type dimensions has four

L 20

.

I

I

I

; /// S

(a) L ty~

(b) A type

(c) C type

2x45o

(f) M type

(g) F type

Fig. 3. Seven types of dimensions.

L

~b80

20

,~ 4,~oo

I-

w

c

O

I

(d) D type (e) R type

T

C

/1

I (a) EC type

Fig. l. Components of dimension.

20

Fig. 4. EC and ED type dimensions.

10 ,_1

i~

=i 10 I-'-

P -i

I I I I I I

(a) a s

Co) EO type

Co)RA kind

(c) IS kind

Fig. 5. Four kinds of dimensions.

10

(d) IA ldad

Using Web grammar to recognize dimensions in engineering drawings combinations of symmetry and regularity. Therefore, there are 27 dimension patterns altogether. As text can be recorded in the middle of the shape according to GB4458-84 (this kind of shape is called a broken line) and the shape can be an unseen line (i.e. phantom shape), dimensions are further classified into 48 subpatterns. More detailed explanation will be given in the following. Figure 6 shows the eight topology prototypes of the L type dimension. In Fig. 6(h), the angle between the shape and the vertical line is less than 30 °. The small rectangles in Figs 6(e)-(h) represent the possible positions for text to locate. But for a specific dimension of a certain pattern, text can be accommodated in only one of the specific possible positions. A line descriptor, i.e. the 4-tuple (?2~br/), is used to describe attributes of line components of dimensions. ~,, )., ~b, r/ are the symbols of the line's attributes, representing geometry, length, font and width, respectively. Yhas the possible values {v, a, b, d, c}, representing vector, arc, break line, straight broken line and arc broken line, respectively. 2 has the possible values {1, s, z}, representing long, short and zero, respectively. q~ has the possible values {c, d, t}, representing continuous, dash and dash-dot, respectively. ~/has the possible values {w, n, z}, representing wide, narrow and zero, respectively. If a line descriptor contains an attribute symbol rather than one of its values, then the specified attribute may take any one of its possible values. Thus, (a2cr/), for example, means an arc of any length, with continuous font, and of any width. If a line descriptor contains the complement of a value (such as e, the complement of c), then the corresponding attribute may take all the values except the one under the complement symbol. Thus, if the value of ~b is e, then ~b has the possible values d and t. If ), has value v or a, we say ? has value r. If ), has values v or b, we say 2: has value u. Thus, (u~.cw), for example, means a vector or a break line of short or long length, with continuous font, and of wide width. The mathematical descriptions of eight L type dimension subpatterns is shown in Table 1. The first column in the table is the index number of the subpattern. Type means regularity, symmetry and functional

Table 1. Mathematical descriptions of eight L type dimension subpatterns No.

Type

L

S

W

C

A T

1 2 3 4 5 6 7 8

RSL RSL ISL ISL RAL RAL IAL IAL

--vscn vscn u2cn u~cn u~cn uZcn

vlcn dlcn vscn -vscn -vscn v~cn

vgan vgan v;tdn v2an v2an vRdn vAan vAan

r2~w r2iw rXiw r~.~w r2iw r2~w rA~w rAiw

2 2 2 2 2 2 2 2

I-

(d)

(c)

(b)

f--q , I---1

[_...l 1--"1 j

vI

(e)

I-

(f)

L L L L L L L L

type of dimension. For L, S, W and C, values represent their line descriptors. For A and T, values represent arrowhead number of dimension and functional type of dimension text, respectively. A C type dimension has eight subpatterns whose topology prototypes are the same as those of the L type dimension shown in Fig. 6. But their mathematical descriptions are different from those of the L type dimension subpatterns. Both D type dimension and M type dimension are the same also. That is to say, they both have eight subpatterns whose topology prototypes are the same as those of the L type dimension subpatterns shown in Fig. 6. But their mathematical descriptions are different from those of the L type dimension subpatterns. An A type dimension has only seven subpatterns whose topology prototypes are the same as those of the L type dimension subpatterns shown in Figs 6(a)-(g). Their mathematical descriptions are different from those of the L type dimension subpatterns. An R type dimension has six subpatterns whose topology prototypes are shown in Fig. 7. Upon the above discussion, each of the L, C, D, M type dimensions has eight subpatterns. An R type dimension has six subpatterns while an A type dimension has seven subpatterns. ED, EC and F type dimensions are the other three subpatterns. Therefore, there are 48 subpatterns altogether. Apart from the F type dimension, the other 47 subpatterns have arrowhead(s) as their component. These 47 subpatterns are called arrowhead type dimension subpatterns, which can be described with a web

V'~ (a)

1409

j I----1 Vl ['-"]

(g)

Fig. 6. Topology prototypes of eight L type dimension subpatterns.

0a)

1410

W. MIN et al.

(a)

(c)

(b)

(e)

(d)

(f)

Fig. 7. Topology prototypes of six R type dimension subpatterns. grammar discussed in Section 4. Therefore, dimensions are further classified into 48 subpatterns, including a subpattern o f F type dimension and 47 arrowhead type dimension subpatterns. Due to the limited space, mathematical descriptions of subpatterns of A, C, D, R, M and F type dimensions are left out.

arrowheads are marked with small circles). When several dimensions share two arrowheads (see Fig. 10), namely dimension chain, the two arrowheads must be used several times to detect the corresponding dimensions. All these obstacles must be settled by the arrowheadmatch algorithm. 3.1. Concept of arrowhead-match

3. ARROWHEAD-MATCH To recognize components of a dimension, detection must start with searching a certain element. As the contour, witness, shape and tail are similar to the object these are not suitable to play this role. Considering that detecting text involves its orientation and location, arrowhead is amenable to act as this part. Recognition of dimension begins with detecting arrowhead. Arrowhead is extracted using the statistical method. But since shape can be a broken line and an unseen line in a complete dimension, how do we know which are two arrowheads of a complete dimension and which is an arrowhead of an incomplete dimension (see Fig. 8). Furthermore, two dimensions may share a c o m m o n arrowhead (abbreviated co-arrowhead) according to GB4458-84, the co-arrowhead must be used twice to detect these two dimensions, see Fig. 9 (co-

_1 I_

_1

Fig. 8. Complicated case of arrowhead-match.

I-I-

30

~o ~

~

I-

Fig. 9. Co-arrowhead.

lit

10

10

10 15

l

Fig. 10. Dimension chain.

l_ 10

l-

An arrowhead is an odd-arrowhead if it belongs to an R type or EC type or ED type dimension. An odd-arrowhead can exist all alone. Whereas, an arrowhead is a twin-arrowhead if it belongs to a complete dimension. A twin-arrowhead must exist at a pair. The process to determine whether an arrowhead is an oddarrowhead or one of a twin-arrowhead is arrowheadmatch. An arrowhead is matched if it has been ascertained to be an odd-arrowhead or a twin-arrowhead. We say that arrowhead A matches arrowhead B if they are two arrowheads of a complete dimension. In Fig. 8, every arrowhead can be an odd-arrowhead or a twin-arrowhead, and they may be a co-arrowhead of two adjacent dimensions. 3.2. Nine arrowhead-match patterns Text can be accommodated between two arrowheads or along one of its tails as shown in Fig. 1 l(a). But in Fig. 1 l(b) text of the dimension which is composed by arrowhead A and arrowhead B cannot be accommodated on the right of arrowhead B. Every arrowhead gets a restraining-factor (abbreviated as R-factor) when it performs arrowhead-match. When the R-factor is assigned a value Y, it is active, text in this dimension cannot be searched outside along the arrowhead. When its value is N, the R-factor is not active, text can be searched outside along the arrowhead. The R-factor has no meaning for an odd-arrowhead. An arrowhead's R-factor value is Y if and only if the arrowhead is a co-arrowhead or a pair of opposite arrowheads (see Fig. 12). Otherwise, the R-factor value is N. The Rfactor restrains the possible positions for searching text.

Using Web grammar to recognize dimensions in engineering drawings ~l

A

I~

Vl

I-

..d

B

I

--I

whose symbols and functions are listed as follows:

~1

14

(a) Co) Fig. 11. R - f a c t o r ' s restraint.

_1_ Fig. 12. Colliding arrowhead. Based on the R-factor, arrowhead-match patterns can be classified into nine patterns (see Fig. 13). The arrowhead-match status of dimensions in Figs 13(a),(b) and (d) are TWO_l, T W O ~ and TWO_4, respectively. Dimensions in these three cases can be of the symmetric or asymmetric kind since there is at least one arrowhead whose R-factor value is N. The arrowhead-match status of dimensions in Figs 13(e)-(g) are TWO_5, TWO_6 and TWO_8, respectively. Dimensions in these three cases can only be of the symmetric kind as both arrows have an R-factor value of Y. Figures 13(h),(i) are positive odd-arrowhead and negative odd-arrowhead, whose arrowhead-match status are ONE_P and ONE_N (upward vertical arrowhead, rightward horizontal arrowhead, rightward slant arrowhead and clockwise arc arrowhead are positive arrowhead; the others are negative arrowhead). For Fig. 13(c), whose arrowhead-match status is TWO_3, text is bound to be recorded in the middle of the broken-line shape and so the R-factor has no meaning. Arrowhead-match patterns can be described with 5-tuple (Ar-status, A, B, AC, BC). Here, the value of the Ar-status is one of nine arrowhead-match status, A and B are two arrowheads with AC, BC as their R-factors. It describes the basic topology structure of dimension and restrains the possible positions for searching text. It is fundamental in detecting components of dimension.

4. D I M E N S I O N ' S WEB GRAMMAR AND DFA BASED ON NINE ARROWHEAD-MATCH PATTERNS

4.1. Associators The spatial relation between any pair of adjacent components within a dimension is determined by a binary infix operator termed associator. In order to deal with dimensions in machine engineering drawings in People's Republic of China, 10 associators are defined,

,'-

-, -'

(a) TWO_I ~ r'--] , ¢ --, (e) TWO_5

-, -'

,'-

(b) TWO_2 _, I---'1~_ -, ,(f) TWO_6

1411

P0: For an irregular symmetric complete dimension which has no shape (i.e. phantom shape), text is associated with arrowhead. PI: Text is placed above shape or tail. P2: Arrowhead overlaps shape or tail; arrowhead's tip and line's edge coincide. P3: Arrowhead points at shape; arrowhead's tip and shape's edge coincide. P4: Witness or shape is pierced by arrowhead. P5: Witness guides to contour. P6: For a dimension whose shape is a broken line, text is associated with shape. P7: Text is placed above or beside the shape or tail. P8: For a regular asymmetric complete dimension which has no shape (i.e. phantom shape), an arrowhead is associated with the other arrowhead. P9: For an irregular asymmetric R type dimension, tail is associated with shape. We can make use of these associators to describe the web structure of dimensions. A web is defined as an undirected, node labeled graph. The dimensioning components and the relations among them are conveniently described as webs. Figure 14(b) is the web description of the dimension shown in Fig. 14(a). Figure 14(c) is the web structure of Fig. 14(a) after the associators embedded in the web description in Fig. 14(b). Here, TL, St, WL and CL represent components T, S, W and C of L type dimension, respectively. A more detailed discussion on the dimension's web description is given by Dori. ~2'31 4.2. Web grammar of dimension A dimension's web grammar based on nine arrowheadmatch patterns is used to describe 47 arrowhead type dimension subpatterns mentioned in Section 2. It is defined formally as a four-tuple G = {N, TT, PP, SS} where N is a finite set of nonterminals, TT a finite set of terminals, PP a finite set of web rewriting rules, and SS the starting symbol. N = {SS, ONE, TWO, EC, ECD, RD, RSR, ISR, RAR, IAR, BR, TWOI, TWO2, TWO3, TWO4, TWO5 TWO6, TWO7, TWO8, TTWO1, TTWO2, TTWO4,

BB}. TT = {q~,A} u Q , where A is arrowhead, Q = {P0, P1, P2, P3, P4, P5, P6, P7, PS, P9} is the set of l0 associators, ~ = {C, W, S, L} is the set of dimension's

~-r---I-..t

(e) TWO_3

--,q r--l I--(g) TWO_8

-1

I-

(d) TWO_4

"1 (h) ONE_P

Fig. 13. Nine arrowhead-match patterns.

t_.

(i) ONE_N

1412

W. M1rqet al.

li E li E

zo =[

(a)

E

(b)

(c)

Fig. 14. Use web grammar to describe dimension. components: contour, witness, shape and tail, and 2 = {L, A, C, D, R, M} is the set of function types of dimensions which have arrowheads. 4~a denotes component q~of type 2. Wc, for example, represents witness of C type dimension. A web rewriting rule is defined as a triplet (~t, fl, f), where 0t and fl are web, and f is a function. Function fspecifies the embedding of fl in place of ~t, that is, it specifies how to join the nodes of fl to the neighbors of each node of removed subweb ~. For example, f(B, A ) = {C, D} means "join node B (in fl) to the neighbors of node A (in ~) whose labels are either C or D". We will omit the embedding specification and instead use the term "normal" to denote situations in which there is no ambiguity in a rewriting rule. The 22 web rewriting rules of the dimension's web grammar based on nine arrowhead-match patterns are listed as follows. Rule 1: (Incomplete dimension and complete dimension) cx= SS, fl = ONEITWO, f is normal. Rule 2: (EC, ED and R-type dimensions) = ONE, fl = ECIECDIRD, f is normal. Rule 3: (EC type dimension which has no witness) = EC, f is normal, fl is the following web:

L] O1'

ii,1 Rule 5: (Four combinations of regularity and symmetry for R type dimensions) ~t = RD, f is normal, fl is the following web:

Rule 6: (Regular symmetric R type dimension) = RSR, f(A, RSR)= {BR, P4}, fl is the following web:

L

Rule 7: (Irregular symmetric R type dimension) ~t = ISR, f(A, ISR) = {BR, P4}, fl is the following web:

Rule 4: (EC type dimension which has no witness and ED type dimension) ct = ECD, f is normal, fl is the following web:

Using Web grammar to recognize dimensions in engineering drawings Rule 8: (Regular asymmetric R type dimension) ~t=RAR, f(A, RAR)= {BR, P4), fl is the following web:

1413

Rule 15: (Arrowhead-match status is TWO_2) = T W O 2 , / 3 = T W O 6 1 T T W O 2 , f is normal. Rule 16: (Irregular symmetric complete dimension whose arrowhead-match status is TWO_6) ct = TWO6, f is normal, ~ is the following web:

Rule 9: (Irregular asymmetric R type dimension) ct = IAR, f(A, IAR) = {BR, P4}, fl is the following web:

Rule 17: (Regular asymmetric complete dimension) e = TTWO2, f is normal, ~ is the following web:

Rule 10: (Contour of R type dimension) c~= BR, f(P4, BR) = {A, RSR, ISR, RAN, IAR}, B is the following web:

Rule 11: (Seven arrowhead-match patterns of complete dimensions) c~= TWO, f is normal. //=TWO 11TWO21TWO31TWO41 TWO5 ITWO61TWO8. Rule 12: (Arrowhead-match status is TWO_l) 7 = T W O I , f l = T W O 5 1 T T W O 1 , f is normal. Rule 13: (Regular symmetric complete dimension whose arrowhead-match status is TWO_5) ct = TWO5, f is normal, fl is the following web (where 2~{L,A,C,D,M}, 2 has the same meaning in the following rules):

Rule 14: (Irregular asymmetric complete dimension) c~= TTWO l, f is normal, B is the following web:

Rule 18: (Regular symmetric complete dimension whose arrowhead-match status is TWO_3) e = TWO3, f is normal, B is the following web:

Rale 19: (Arrowhead-match status is TWO 4) c~= TWO4, ~ = TWO8)TTWO4, f is normal. Rule 20: (Irregular symmetric complete dimension whose arrowhead-match status is TWO_8) ct = TWO8, f is normal, fl is the following web:

Rule 21: (Regular asymmetric complete dimension) e = TTWO4, f is normal, ~ is the following web:

W. MINet al.

1414

Rule 22: (Witness and contour of complete dimensions) ~t = BB, f(P4, BB) = {A}, fl is the following web:

or

E $-'] EU E,7 EO

By using this web grammar, we can generate all the 47 arrowhead type dimension subpatterns mentioned in Section 2. For example, using Rule 1, Rule 1 l, Rule 12, Rule 13 and Rule 22 successively, we can obtain the web structure in Fig. 14(c) of the dimension in Fig. 14(a). 5. IMPLEMENTATIONAND EXAMPLES 5.1. Implementation Based on the dimension's web grammar described above, an algorithm for recognizing dimensions in engineering drawings has been implemented in C on a H P workstation. The input is line list and arrowhead list which are given by extracting module, and the output is the recognized dimension list and error dimension list. For dimensions with arrowheads, the algorithm forms tolerance arrowhead chain, then matches arrowheads in tolerance arrowhead chain, and finally sends matched arrowheads into a specific deterministic finite automation (DFA) to detect components, checks their rationality and rectifies compatibility among them. Chamfer dimension is recognized separately according to its characteristic. The algorithm classifies arrowheads whose overlapped lines are colliner or cocircular within tolerance into a sorted queue named tolerance arrowhead chain. Apparently, only two adjacent arrowheads in the same tolerance arrowhead chain can match mutually. The arrowhead-match algorithm processes every arrowhead in a tolerance arrowhead chain. Its output is arrowhead-match pattern 5-tuple. After having been processed by this algorithm, every arrowhead has been ascertained whether it is an odd-arrowhead or a twinarrowhead. Two arrowheads of a complete dimension have been matched and stored in an arrowhead-match pattern. Both arrowheads that the extracting module fails to extract and arrowheads that drawers leave out (i.e. missing arrowheads) have been added in the proper positions. Co-arrowhead has been used twice for the correspondent dimensions to form two arrowheadmatch patterns. Dimension chain has added arrowheads in the proper positions. The arrowhead-match pattern records the arrowhead(s) of a dimension and restrains the positions for searching dimension text.

All components of dimension characterized by arrowhead are detected by using a DFA corresponding to the dimension's web grammar. A top-down strategy is adopted in the algorithm. The searching of components is guided by both arrowhead-match status and the dimension pattern's topology prototype. Text is searched according to the possible position given by the pattern's prototype. The orientation can be obtained from the line that text attaches. A grammar is used to recognize a text string. In the meanwhile, rationality of every component is checked according to mathematical description of the dimension pattern, and compatibility among components is rectified according to given rules. Two rules are shown as an example: Rule 1: Text is angular type if and only if the shape is an arc. Rule 2: For a complete circular type dimension, the other contour must be an arc if one contour is an arc. Chamfer dimension in Chinese engineering drawings has no arrowhead to guide, and must be detected and recognized according to its characteristic. In Fig. 2, chamfer appears nearby a thin solid straight line. One end of this line is a pending extreme and the other attaches to another thin solid straight line which attaches to a short wide solid straight line. 60 I0 ~ 2 0 - ~

~-- 20-~

Fig. 15.

,o-q

~,-20--~

I'

(3) RAL ii

60

I

I

~-2o-.~

I (2) RSL

I

I (3)RSL

~J

(4) ~ L

(5) RSL

(6) RSL Fig. 16. Recognizing results of Fig. 15.

Using Web grammar to recognize dimensions in engineering drawings

1415

example, RSL represents regular, symmetric longitudinal type dimension), and one by one displays the dimension's components (arrowhead, shape, witness, tail, text and contour). Due to limited space, this paper only gives the entire dimension without pointing out every component. Recognizing results of Fig. 15 are shown in Fig. 16. Figure 18 shows the recognizing results of Fig. 17.

= = 20,1 8O

Fig. 17.

6. S U M M A R Y A N D D I S C U S S I O N

I

I_

80

5---4!--

,-

(1) RSL

201

i_ 3O _1 (3) RSL

(2) RAL

(4) RSL

(5)

(6) RSD

In this paper, the concept of arrowhead-match is presented. Nine arrowhead-match patterns are summarized. A dimension's web grammar based on 9 arrowhead-match patterns is described in detail. Based on this web grammar, a practical and effective algorithm for recognizing dimensions in engineering drawings has been outlined and implemented, which can detect dimensions and rectify their rationality according to given rules. Results of experiments indicate that this algorithm can effectively recognize and understand 48 dimension subpatterns in Chinese engineering drawings. This approach makes separated lines, arrowheads, texts combined into groups of dimensions, meanwhile the function of every component has been interpreted. Therefore, a computer can simulate a human being to understand dimensions. This method establishes the base of 3D reconstruction, and is capable of supporting a 3D CAD/CAM system such as dimension driving modeling. Both of the following two aspects are subjects for further research: (1) Validate the appr°priateness °f the dimensi°ning" (2) Transfer dimensions in one projection to another projection and construct a full and precise 3D model of the object.

O

2x450 --'x

REFERENCES (7) RSD

(8) RSM

(9) F

Fig. 18. Recognizing results of Fig. 17.

5.2. Examples Two examples of recognizing results generated by our algorithm are shown in Figs 15-18. The results are shown as follows. Error type is shown for an error dimension. For a correct dimension, the algorithm reports its regularity, symmetry and function type (for

1. R. M. Haralick and D. Queeney, Understanding engineering drawings, Comput. Graphics Imaqe Protests. 20, 244 25,~ (1982). 2. D. Dori, A syntactic/geometric approach to recognition of dimensions in engineering machine drawings, Compul. Vision Graphics Image Process. 47, 271 291 (1989). 3. D. Dori and A. Pnueli, The grammar of dimensions in machine drawings, Comput. Vision Graphics hna~/e Pro~es.s. 42, 1-18 (1988). 4. Chinese National Standard Bureau, P.R. China national standard: machine engineering drawing (GB4457 - 446084, GB131-83), Chinese Standard Publishing House, Beijing (1984).

About the AuthoF--WEIDONGMIN is a doctor candidate in the Department of Computer Science and Technology, Tsinghua University, Beijing, People's Republic of China. He obtained both his BE degree in 1989 and his ME degree in 1991 from Tsinghua University. His current interests include computational geometry, AI CAD and drawing understanding.

1416

W. MIN et al. About the Author--ZESrmNG TANGis a professor of Computer Science and Technology and the director of Computer Aided Design Technology Research group of Tsinghua University, Beijing, China. He graduated from the Department of Electrical Engineering of Tsinghua University. In 1985-1986, he visited the University of Michigan and worked in Xerox Palo Alto Research Center in California. His current research interests include geometric modeling, volume visualization and computational geometry. Zesheng Tang is the vice chairman of the CAD and Computer Graphics Society of China Computer Federation and the Computer Engineering and Application Society of China Electronic Institute. He was co-chairman of I FI P 1991 Conference on Modeling in Computer Graphics and is program chairman of the Third International Conference on CAD and Computer Graphics to be held in 1993 in Beijing.

About the Author--LoNG TANG is an associate professor in the Department of Computer Science and Technology in Tsinghua University, Beijing, People's Republic of China. After he graduated from the Department of Automatic Control in Tsinghua University in 1963, he has been working in education and research on computer science and application for the past 29 years.