0031382: Data Exchange - BinXCAF should preserve length unit information
[occt.git] / tests / bugs / xde / bug31382
1 puts "# =============================================================================="
2 puts "# 0031382: Data Exchange - BinXCAF should preserve length unit information"
3 puts "# =============================================================================="
4
5 pload DCAF
6
7 box b 10 20 30
8
9 catch { Close D }
10 catch { Close D1 }
11 # check saving value of length unit
12 NewDocument D XmlXCAF
13 XAddShape D b 0
14 XSetLengthUnit D in
15 XSave D ${imagedir}/${casename}.xml
16 XOpen ${imagedir}//${casename}.xml D1
17 set LU [XGetLengthUnit D1]
18 if {$LU != "in"} {
19   puts "Error: Length unit is not coincided with given1"
20 }
21 Close D
22 Close D1
23 NewDocument D BinXCAF
24 XAddShape D b 0
25 XSetLengthUnit D m
26 XSave D ${imagedir}/${casename}.xbf
27 XOpen ${imagedir}//${casename}.xbf D1
28 set LU [XGetLengthUnit D1]
29 if {$LU != "m"} {
30   puts "Error: Length unit is not coincided with given2"
31 }
32 Close D
33 Close D1
34
35 # if length unit is undefined in the document value from session
36 # must be set to document before saving it to xml
37 NewDocument D XmlXCAF
38 param xstep.cascade.unit 5
39 XAddShape D b 0
40 XSave D ${imagedir}/${casename}.xml
41 set LU [XGetLengthUnit D]
42 if {$LU == "mm"} {
43   puts "Error: Length unit is not coincided with given3"
44 }
45 XOpen ${imagedir}//${casename}.xml D1
46 set LU [XGetLengthUnit D1]
47 if {$LU == "stat.mile"} {
48   puts "Length unit is coincided with given"
49 } else {
50   puts "Error: Length unit is not coincided with given4"
51 }
52 Close D
53 Close D1
54
55 # if length unit is undefined in the document value from session
56 # must be set to document before saving it to xbf
57 NewDocument D BinXCAF
58 param xstep.cascade.unit 7
59 XAddShape D b 0
60 XSave D ${imagedir}/${casename}.xbf
61 set LU [XGetLengthUnit D]
62 if {$LU == "km"} {
63   puts "Length unit is coincided with given"
64 } else {
65   puts "Error: Length unit is not coincided with given"
66 }
67 XOpen ${imagedir}//${casename}.xbf D1
68 set LU [XGetLengthUnit D1]
69 if {$LU == "km"} {
70    puts "Length unit is coincided with given"
71 } else {
72    puts "Error: Length unit is not coincided with given"
73 }
74
75 # return to default global unit
76 param xstep.cascade.unit 2
77 file delete ${imagedir}//${casename}.xbf
78 file delete ${imagedir}//${casename}.xml
79
80 Close D
81 Close D1