0022470: Crash during IGES import
[occt.git] / tests / bugs / xde / bug6542
CommitLineData
61c421bf 1puts "========"
2puts "OCC6542"
3puts "========"
4puts ""
5######################################################
6# Circle is translated to IGES as NURBS
7######################################################
8
9set BugNumber OCC6542
10set TheFileName OCC6542.igs
11set TheFileName2 ${TheFileName}-2.igs
12
13set percent_max 0.1
14
15igesbrep [locate_data_file ${TheFileName}] a *
16set comp [tpcompound res1]
17
18set status 0
19set result [checkshape res1]
20set index [lsearch $result Faulty]
21if {$index > -1} {
22 puts "Faulty ${BugNumber} : checkshape is wrong for source file"
23 incr status
24} else {
25 puts "OK ${BugNumber} : checkshape is good for source file"
26
27 set dumpList [split [dump res1] "\n\t :,"]
28 set index1 [lsearch -exact ${dumpList} Circle]
29
30 if {${index1} == -1} {
31 puts "Faulty ${BugNumber} : there is not a cirle in source file"
32 incr status
33 } else {
34 puts "OK ${BugNumber} : there is a cirle in source file"
35 set Center_X_1 [lindex ${dumpList} [expr ${index1} + 5]]
36 set Center_Y_1 [lindex ${dumpList} [expr ${index1} + 7]]
37 set Center_Z_1 [lindex ${dumpList} [expr ${index1} + 9]]
38 set Axis_X_1 [lindex ${dumpList} [expr ${index1} + 17]]
39 set Axis_Y_1 [lindex ${dumpList} [expr ${index1} + 19]]
40 set Axis_Z_1 [lindex ${dumpList} [expr ${index1} + 21]]
41 set XAxis_X_1 [lindex ${dumpList} [expr ${index1} + 28]]
42 set XAxis_Y_1 [lindex ${dumpList} [expr ${index1} + 30]]
43 set XAxis_Z_1 [lindex ${dumpList} [expr ${index1} + 32]]
44 set YAxis_X_1 [lindex ${dumpList} [expr ${index1} + 39]]
45 set YAxis_Y_1 [lindex ${dumpList} [expr ${index1} + 41]]
46 set YAxis_Z_1 [lindex ${dumpList} [expr ${index1} + 43]]
47 set Radius_1 [lindex ${dumpList} [expr ${index1} + 49]]
48 puts "Center_X_1 = ${Center_X_1}"
49 puts "Center_Y_1 = ${Center_Y_1}"
50 puts "Center_Z_1 = ${Center_Z_1}"
51 puts "Axis_X_1 = ${Axis_X_1}"
52 puts "Axis_Y_1 = ${Axis_Y_1}"
53 puts "Axis_Z_1 = ${Axis_Z_1}"
54 puts "XAxis_X_1 = ${XAxis_X_1}"
55 puts "XAxis_Y_1 = ${XAxis_Y_1}"
56 puts "XAxis_Z_1 = ${XAxis_Z_1}"
57 puts "YAxis_X_1 = ${YAxis_X_1}"
58 puts "YAxis_Y_1 = ${YAxis_Y_1}"
59 puts "YAxis_Z_1 = ${YAxis_Z_1}"
60 puts "Radius_1 = ${Radius_1}"
61 }
62
63 brepiges res1 ${imagedir}/${TheFileName2}
64
65 dall
66 if [catch { igesbrep ${imagedir}/${TheFileName2} b * } res] {
67 puts "Error ${BugNumber}: there is reading problem"
68 } else {
69 set comp [tpcompound res]
70 set result [checkshape res]
71 set index [lsearch $result Faulty]
72 if {$index > -1} {
73 puts "Faulty ${BugNumber} : checkshape is wrong for writing file"
74 incr status
75 } else {
76 puts "OK ${BugNumber} : checkshape is good for writing file"
77
78 set dumpList2 [split [dump res] "\n\t :,"]
79 set index2 [lsearch -exact ${dumpList2} Circle]
80
81 if {${index2} == -1} {
82 puts "Faulty ${BugNumber} : there is not a cirle in writing file"
83 incr status
84 } else {
85 puts "OK ${BugNumber} : there is a cirle in writing file"
86 set Center_X_2 [lindex ${dumpList2} [expr ${index2} + 5]]
87 set Center_Y_2 [lindex ${dumpList2} [expr ${index2} + 7]]
88 set Center_Z_2 [lindex ${dumpList2} [expr ${index2} + 9]]
89 set Axis_X_2 [lindex ${dumpList2} [expr ${index2} + 17]]
90 set Axis_Y_2 [lindex ${dumpList2} [expr ${index2} + 19]]
91 set Axis_Z_2 [lindex ${dumpList2} [expr ${index2} + 21]]
92 set XAxis_X_2 [lindex ${dumpList2} [expr ${index2} + 28]]
93 set XAxis_Y_2 [lindex ${dumpList2} [expr ${index2} + 30]]
94 set XAxis_Z_2 [lindex ${dumpList2} [expr ${index2} + 32]]
95 set YAxis_X_2 [lindex ${dumpList2} [expr ${index2} + 39]]
96 set YAxis_Y_2 [lindex ${dumpList2} [expr ${index2} + 41]]
97 set YAxis_Z_2 [lindex ${dumpList2} [expr ${index2} + 43]]
98 set Radius_2 [lindex ${dumpList2} [expr ${index2} + 49]]
99 puts "Center_X_2 = ${Center_X_2}"
100 puts "Center_Y_2 = ${Center_Y_2}"
101 puts "Center_Z_2 = ${Center_Z_2}"
102 puts "Axis_X_2 = ${Axis_X_2}"
103 puts "Axis_Y_2 = ${Axis_Y_2}"
104 puts "Axis_Z_2 = ${Axis_Z_2}"
105 puts "XAxis_X_2 = ${XAxis_X_2}"
106 puts "XAxis_Y_2 = ${XAxis_Y_2}"
107 puts "XAxis_Z_2 = ${XAxis_Z_2}"
108 puts "YAxis_X_2 = ${YAxis_X_2}"
109 puts "YAxis_Y_2 = ${YAxis_Y_2}"
110 puts "YAxis_Z_2 = ${YAxis_Z_2}"
111 puts "Radius_2 = ${Radius_2}"
112
113 set Center_X_percent [GetPercent ${Center_X_2} ${Center_X_1}]
114 set Center_Y_percent [GetPercent ${Center_Y_2} ${Center_Y_1}]
115 set Center_Z_percent [GetPercent ${Center_Z_2} ${Center_Z_1}]
116
117 set Axis_X_percent [GetPercent ${Axis_X_2} ${Axis_X_1}]
118 set Axis_Y_percent [GetPercent ${Axis_Y_2} ${Axis_Y_1}]
119 set Axis_Z_percent [GetPercent ${Axis_Z_2} ${Axis_Z_1}]
120
121 set XAxis_X_percent [GetPercent ${XAxis_X_2} ${XAxis_X_1}]
122 set XAxis_Y_percent [GetPercent ${XAxis_Y_2} ${XAxis_Y_1}]
123 set XAxis_Z_percent [GetPercent ${XAxis_Z_2} ${XAxis_Z_1}]
124
125 set YAxis_X_percent [GetPercent ${YAxis_X_2} ${YAxis_X_1}]
126 set YAxis_Y_percent [GetPercent ${YAxis_Y_2} ${YAxis_Y_1}]
127 set YAxis_Z_percent [GetPercent ${YAxis_Z_2} ${YAxis_Z_1}]
128
129 set Radius_percent [GetPercent ${Radius_2} ${Radius_1}]
130
131 if {${Center_X_percent} > ${percent_max}} {
132 puts "Faulty ${BugNumber} : Center_X is wrong"
133 incr status
134 }
135 if {${Center_Y_percent} > ${percent_max}} {
136 puts "Faulty ${BugNumber} : Center_Y is wrong"
137 incr status
138 }
139 if {${Center_Z_percent} > ${percent_max}} {
140 puts "Faulty ${BugNumber} : Center_Z is wrong"
141 incr status
142 }
143
144 if {${Axis_X_percent} > ${percent_max}} {
145 puts "Faulty ${BugNumber} : Axis_X is wrong"
146 incr status
147 }
148 if {${Axis_Y_percent} > ${percent_max}} {
149 puts "Faulty ${BugNumber} : Axis_Y is wrong"
150 incr status
151 }
152 if {${Axis_Z_percent} > ${percent_max}} {
153 puts "Faulty ${BugNumber} : Axis_Z is wrong"
154 incr status
155 }
156
157 if {${XAxis_X_percent} > ${percent_max}} {
158 puts "Faulty ${BugNumber} : XAxis_X is wrong"
159 incr status
160 }
161 if {${XAxis_Y_percent} > ${percent_max}} {
162 puts "Faulty ${BugNumber} : XAxis_Y is wrong"
163 incr status
164 }
165 if {${XAxis_Z_percent} > ${percent_max}} {
166 puts "Faulty ${BugNumber} : XAxis_Z is wrong"
167 incr status
168 }
169
170 if {${YAxis_X_percent} > ${percent_max}} {
171 puts "Faulty ${BugNumber} : YAxis_X is wrong"
172 incr status
173 }
174 if {${YAxis_Y_percent} > ${percent_max}} {
175 puts "Faulty ${BugNumber} : YAxis_Y is wrong"
176 incr status
177 }
178 if {${YAxis_Z_percent} > ${percent_max}} {
179 puts "Faulty ${BugNumber} : YAxis_Z is wrong"
180 incr status
181 }
182
183 if {${Radius_percent} > ${percent_max}} {
184 puts "Faulty ${BugNumber} : Radius is wrong"
185 incr status
186 }
187
188 }
189 }
190 }
191}
192
193puts ""
194if {${status} == 0} {
195 puts "${BugNumber}: OK"
196} else {
197 puts "${BugNumber}: Error"
198}
199
200