0024164: Optimization of OCAF document closing
[occt.git] / tests / bugs / caf / bug23766_5
1 puts "=========="
2 puts "OCC23766"
3 puts "=========="
4 puts ""
5 ########################################################
6 # Shape orientation processing mechanis, redesign
7 ########################################################
8
9 ## test for keeping Orientation (std)
10
11 erase
12 NewDocument D MDTV-Standard
13 #1 - create box
14 NewCommand D
15 set B2 [AddObject D];                   ## add object
16 set F2 [AddFunction D $B2 Box];         ## add function
17 BoxDX D $B2 190;                        ## set argumets of this function
18 BoxDY D $B2 290
19 BoxDZ D $B2 390
20 InitLogBook D;                          ## initialize (clean) internal maps of labels
21 AddDriver D Box Attach  
22 ComputeFun D $F2;                       ## compute the function
23 GetShape D $F2:2 Box2;                  ## check result
24
25 #2 - make selections keeping orientation
26 explode Box2 F
27 explode Box2_1 E
28 explode Box2_3 E
29 don Box2_1_1 Box2_3_4
30 set Sel1 [AttachShape D Box2_1_1 ${B2} ${B2} 1]; ## set attachment keeping orientation of the edge
31 set Sel2 [AttachShape D Box2_3_4 ${B2} ${B2} 1]; ## set attachment keeping orientation of the edge
32
33 #3 - check orientation of the selected shapes
34 GetShape D 0:1:2:1:2 E1
35 set info1 [whatis E1]
36 ## to be: E1 is a shape EDGE FORWARD Modified Orientable
37 if { [regexp "FORWARD" $info1] != 1 } {
38     puts "Error: orientation of E1 is incorrect"
39 } else {
40     puts "OK: orientation of E1 is correct"
41 }
42
43 GetShape D 0:1:3:1:2 E2
44 set info2 [whatis E2]
45 ## to be: E2 is a shape EDGE REVERSED Modified Orientable
46 if { [regexp "REVERSED" $info2] != 1 } {
47     puts "Error: orientation of E2 is incorrect"
48 } else {
49     puts "OK: orientation of E2 is correct"
50 }
51
52 #4 -  test persistence: check orientation after retrieving (to be the same as before)
53 file delete -force ${imagedir}/bug23766_ttt1.std
54 NewCommand D
55 SaveAs D ${imagedir}/bug23766_ttt1.std
56 Close D
57 ##unset D
58 Open ${imagedir}/bug23766_ttt1.std D
59 GetShape D 0:1:2:1:2 E1
60 set info3 [whatis E1]
61 ## to be: E1 is a shape EDGE FORWARD Modified Orientable
62 if { [regexp "FORWARD" $info3] != 1 } {
63     puts "Error: orientation of E1 is incorrect"
64 } else {
65     puts "OK: orientation of E1 is correct"
66 }
67
68 GetShape D 0:1:3:1:2 E2
69 set info4 [whatis E2]
70 ## to be: E2 is a shape EDGE REVERSED Modified Orientable
71 if { [regexp "REVERSED" $info4] != 1 } {
72     puts "Error: orientation of E2 is incorrect"
73 } else {
74     puts "OK: orientation of E2 is correct"
75 }