fa6fc587 |
1 | # ============= OCAF ============================ |
2 | # Naming |
3 | # |
4 | # Testing purpose: Shape evolution history |
5 | # |
6 | # Test case: D4 |
7 | # |
8 | # 1. Create Box B1 |
9 | # 2. Create Box B2 |
10 | # Translate B2 to -100 400 -130 |
11 | # 4. Cut (B1, B2) |
12 | # 5. Create Box B3 |
13 | # Translate B3 to -100 -20 -130 |
14 | # 5. Cut (B1, B3) |
15 | # 6. Check descendant of B1 |
16 | # 7. CurrentShape of 6 faces of B1 |
17 | # =============================================== |
18 | |
19 | pload ALL |
20 | NewDocument D BinOcaf |
21 | |
22 | AddDriver D Box PTxyz Cut Fuse Prism |
23 | |
24 | #1 Box1 creation |
25 | NewCommand D |
26 | set B1 [AddObject D]; ## add object |
27 | set F1 [AddFunction D $B1 Box]; ## add function |
28 | BoxDX D $B1 190 |
29 | BoxDY D $B1 890 |
30 | BoxDZ D $B1 290 |
31 | InitLogBook D; |
32 | ComputeFun D $F1; |
33 | ## GetShape D $F1:2 Box2; |
34 | GetReference D $B1 |
35 | |
36 | #2 Box2 creation |
37 | NewCommand D |
38 | set B2 [AddBox D 390 190 490] |
39 | ComputeFun D $B2:1 |
40 | GetShape D $B2:1:2 Box; |
41 | NewCommand D |
42 | set FTr1 [PTranslateDXYZ D $B2 -100 400 -130] |
43 | ComputeFun D $FTr1 |
44 | ## GetShape D $B2:2:2 Box |
45 | |
46 | #3 First cut |
47 | NewCommand D |
48 | set CS1 [AddCut D $B1 $B2] |
49 | ComputeFun D $CS1 |
50 | GetShape D $CS1:2 S1 |
51 | NewCommand D |
52 | |
53 | #4 Box3 creation |
54 | set B3 [AddBox D 390 490 490] |
55 | ComputeFun D $B3:1 |
56 | set FTr2 [PTranslateDXYZ D $B3 -100 -20 -130] |
57 | ComputeFun D $FTr2 |
58 | |
59 | #5 Second cut |
60 | NewCommand D |
61 | set CS2 [AddCut D $B1 $B3] |
62 | ComputeFun D $CS2 |
63 | |
64 | #6 CurrentShape of B1 |
65 | CurrentShape D $F1:2 B13 |
66 | |
67 | GetShape D $F1:2 BB |
68 | Descendants D BB |
69 | Descendants D BB_new_0 |
70 | set info0 [whatis BB_new_0_new_0] |
71 | ## to be: BB_new_0_new_0 is a shape SOLID FORWARD Modified |
72 | if { [regexp "SOLID" $info0] != 1 } { |
73 | puts "Error: current descendant of BB is incorrect" |
74 | } else { |
75 | puts "OK: current descendant of BB is correct" |
76 | } |
77 | |
78 | |
79 | #7 CurrentShape of faces of B1 |
80 | CurrentShape D $F1:2:1 f1 |
81 | set info1 [whatis f1] |
82 | ## to be: f1 is a shape FACE REVERSED Modified Orientable |
83 | if { [regexp "FACE REVERSED" $info1] != 1 } { |
84 | puts "Error: current shape of face1 of Box1 is incorrect" |
85 | } else { |
86 | puts "OK: current shape of face1 of Box1 is correct" |
87 | } |
88 | |
89 | CurrentShape D $F1:2:2 f2 |
90 | set info2 [whatis f2] |
91 | ## to be: f2 is a shape FACE FORWARD Modified Orientable |
92 | if { [regexp "FACE FORWARD" $info2] != 1 } { |
93 | puts "Error: current shape of face2 of Box1 is incorrect" |
94 | } else { |
95 | puts "OK: current shape of face2 of Box1 is correct" |
96 | } |
97 | |
98 | CurrentShape D $F1:2:3 f3 |
99 | set info3 [whatis f3] |
100 | ## to be: f3 is a shape FACE FORWARD Modified Orientable |
101 | if { [regexp "FACE FORWARD" $info3] != 1 } { |
102 | puts "Error: current shape of face3 of Box1 is incorrect" |
103 | } else { |
104 | puts "OK: current shape of face3 of Box1 is correct" |
105 | } |
106 | CurrentShape D $F1:2:4 f4 |
107 | set info4 [whatis f4] |
108 | ## to be: f4 is a shape FACE FORWARD Modified Orientable |
109 | if { [regexp "FACE FORWARD" $info4] != 1 } { |
110 | puts "Error: current shape of face4 of Box1 is incorrect" |
111 | } else { |
112 | puts "OK: current shape of face4 of Box1 is correct" |
113 | } |
114 | |
115 | CurrentShape D $F1:2:5 f5 |
116 | set info5 [whatis f5] |
117 | ## to be: f5 is a shape FACE REVERSED Modified Orientable |
118 | if { [regexp "FACE REVERSED" $info5] != 1 } { |
119 | puts "Error: current shape of face5 of Box1 is incorrect" |
120 | } else { |
121 | puts "OK: current shape of face5 of Box1 is correct" |
122 | } |
123 | CurrentShape D $F1:2:6 f6 |
124 | set info6 [whatis f6] |
125 | ## to be: f6 is a |
126 | if { [regexp "f6 is a" $info6] != 1 } { |
127 | puts "Error: current shape of face6 of Box1 is incorrect" |
128 | } else { |
129 | puts "OK: current shape of face6 of Box1 is correct (deleted)" |
130 | } |