1e98cae5d0c82dad3d00bd171bb374f42bf0a07d
[occt.git] / tests / persist / fsd / B2
1 # check write / read set of shapes with names to FSD archive and reading its back
2
3 # create 7 shapes
4 box b1 10 20 30
5 box b2 100 0 0 20 30 40
6 box b3 200 0 0 30 40 50
7 box b4 300 0 0 40 50 60
8 box b5 400 0 0 50 60 70
9 box b6 500 0 0 60 70 80
10 box b7 600 0 0 70 80 90
11
12 # calculate mass of each shape and keep to 'wb%' variable
13 regexp {Mass +: +([-0-9.+eE]+)} [vprops b1] full wb1
14 regexp {Mass +: +([-0-9.+eE]+)} [vprops b2] full wb2
15 regexp {Mass +: +([-0-9.+eE]+)} [vprops b3] full wb3
16 regexp {Mass +: +([-0-9.+eE]+)} [vprops b4] full wb4
17 regexp {Mass +: +([-0-9.+eE]+)} [vprops b5] full wb5
18 regexp {Mass +: +([-0-9.+eE]+)} [vprops b6] full wb6
19 regexp {Mass +: +([-0-9.+eE]+)} [vprops b7] full wb7
20
21 # remove old file if exist
22 catch {file delete ${imagedir}/test29402.cmp}
23
24 # write set of shapes to the file
25 fsdwrite b1 b2 b3 b4 b5 b6 b7 ${imagedir}/test29402.cmp cmp
26
27 # unset variables
28 unset b1 b2 b3 b4 b5 b6 b7
29
30 # read back the file
31 fsdread ${imagedir}/test29402.cmp restore_with_names
32
33 # calculate mass of each shape and keep to 'rb%' variable
34 regexp {Mass +: +([-0-9.+eE]+)} [vprops b1] full rb1
35 regexp {Mass +: +([-0-9.+eE]+)} [vprops b2] full rb2
36 regexp {Mass +: +([-0-9.+eE]+)} [vprops b3] full rb3
37 regexp {Mass +: +([-0-9.+eE]+)} [vprops b4] full rb4
38 regexp {Mass +: +([-0-9.+eE]+)} [vprops b5] full rb5
39 regexp {Mass +: +([-0-9.+eE]+)} [vprops b6] full rb6
40 regexp {Mass +: +([-0-9.+eE]+)} [vprops b7] full rb7
41
42 # compare mass property of old and new shapes
43 set NumBad 0
44 if { $wb1 != $rb1 } {
45     puts " Faulty : incorrect shape $b1"; incr NumBad
46
47 if { $wb2 != $rb2 } {
48     puts " Faulty : incorrect shape $b2"; incr NumBad
49 }  
50 if { $wb3 != $rb3 } {
51     puts " Faulty : incorrect shape $b3"; incr NumBad
52
53 if { $wb4 != $rb4 } {
54     puts " Faulty : incorrect shape $b4"; incr NumBad
55 }
56 if { $wb5 != $rb5 } {
57     puts " Faulty : incorrect shape $b5"; incr NumBad
58 }
59 if { $wb6 != $rb6 } {
60     puts " Faulty : incorrect shape $b6"; incr NumBad
61 }
62 if { $wb7 != $rb7 } {
63     puts " Faulty : incorrect shape $b7"; incr NumBad
64
65 if { $NumBad == 0} {
66     puts " BUG29402 OK : All shapes kept properly"
67 } else {
68     puts " Faulty : Found $NumBad bad shapes"
69 }
70