509792178ad22a1f0bfdd144c91023083883cffc
[occt.git] / tests / caf / named_shape / E9
1 # ============= OCAF ============================
2 # Naming
3 #
4 # Testing purpose: Naming selection mechanism 
5 #
6 # Test case: E9 (ShapeOrientation is not used)
7 #
8 # 1. Create Box B1
9 # 2. Create 4 spheres ($Sph1 - $Sph4)
10 # 3. Rotate all spheres around line
11 # 4. Fuse all spheres with box B1
12 # 5. Make selection for all sub-shapes
13 # 6. Modify B1
14 # 7. Recompute modeling functions
15 # 8. Recompute selections
16 # ===============================================
17
18 #pload FULL
19 erase 
20 Close D 
21
22 NewDocument D BinOcaf
23 isos 12
24
25 #1 - create Box using short-cut
26 NewCommand D
27 AddDriver D Box;                        ## add box driver to driver table
28 set B1 [AddBox D 130 140 150];          ## add box 
29 ComputeFun D $B1:1;                     ## compute box1 function
30 GetShape D $B1:1:2 Box1;                ## check result
31 whatis Box1
32 # referes to result NS
33 GetReference D $B1;                     ## check is reference set 
34
35
36 #2 - create 4 spheres
37 AddDriver D Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
38 NewCommand D
39 explode Box1 V
40 set SPnt1 [AttachShape D Box1_1 ${B1} ${B1} 0]; ## set attachment
41 set SPnt2 [AttachShape D Box1_2 ${B1} ${B1} 0]; ## set attachment
42 set SPnt3 [AttachShape D Box1_3 ${B1} ${B1} 0]; ## set attachment
43 set SPnt4 [AttachShape D Box1_4 ${B1} ${B1} 0]; ## set attachment
44
45 set Sph1 [AddSphere D $SPnt1 25]
46 ComputeFun D $Sph1:1
47 GetShape D $Sph1:1:2 Sp1
48
49 set Sph2 [AddSphere D $SPnt2 25]
50 ComputeFun D $Sph2:1
51 GetShape D $Sph2:1:2 Sp2
52
53 set Sph3 [AddSphere D $SPnt3 25]
54 ComputeFun D $Sph3:1
55 GetShape D $Sph3:1:2 Sp3
56
57 set Sph4 [AddSphere D $SPnt4 25]
58 ComputeFun D $Sph4:1
59 GetShape D $Sph4:1:2 Sp4
60 NewCommand D
61
62 #3 Rotate spheres
63 explode Box1 E
64 set Sel1 [AttachShape D Box1_1 ${B1} ${B1} 0];
65 set FR1 [PRotateRoundLine D $Sph1 $Sel1 120]
66 ComputeFun D $FR1 
67 GetShape D $FR1:2 Sp1
68
69 set Sel2 [AttachShape D Box1_1 ${B1} ${B1} 0];
70 set FR2 [PRotateRoundLine D $Sph2 $Sel2 120]
71 ComputeFun D $FR2
72 GetShape D $FR2:2 Sp2
73
74 set Sel3 [AttachShape D Box1_3 ${B1} ${B1} 0];
75 set FR3 [PRotateRoundLine D $Sph3 $Sel3 120]
76 ComputeFun D $FR3
77 GetShape D $FR3:2 Sp3
78
79 set Sel4 [AttachShape D Box1_3 ${B1} ${B1} 0];
80 set FR4 [PRotateRoundLine D $Sph4 $Sel4 120]
81 ComputeFun D $FR4
82 GetShape D $FR4:2 Sp4
83 NewCommand D
84
85 #4 Fuse spheres
86 set FS1 [AddFuse D $B1 $Sph1]
87 ComputeFun D $FS1
88 GetShape D $FS1:2 Box1
89
90 set FS2 [AddFuse D $B1 $Sph2]
91 ComputeFun D $FS2
92 GetShape D $FS2:2 Box1
93
94 set FS3 [AddFuse D $B1 $Sph3]
95 ComputeFun D $FS3
96 GetShape D $FS3:2 Box1
97
98 set FS4 [AddFuse D $B1 $Sph4]
99 ComputeFun D $FS4
100 GetShape D $FS4:2 Box1
101
102
103 #5 test selection
104 NewCommand D
105 set SL [TestSingleSelection D $B1 0]
106 set SL2 [TestMultipleSelection D $B1 0]
107
108 #6 modification
109 NewCommand D
110 BoxDX D $B1 210
111 BoxDZ D $B1 270
112
113 #7 recomputation
114 NewCommand D
115 InitLogBook D;          ## to be initialized before any recomputation of impacted functions set (if attachments are presented)
116 ComputeFun D $B1:1
117 ComputeFun D $SPnt1:1
118 ComputeFun D $SPnt2:1
119 ComputeFun D $SPnt3:1
120 ComputeFun D $SPnt4:1
121 ComputeFun D $Sph1:1
122 ComputeFun D $Sph2:1
123 ComputeFun D $Sph3:1
124 ComputeFun D $Sph4:1
125 ComputeFun D $Sel1:1
126 ComputeFun D $Sel2:1
127 ComputeFun D $Sel3:1
128 ComputeFun D $Sel4:1
129 ComputeFun D $FR1 
130 ComputeFun D $FR2
131 ComputeFun D $FR3
132 ComputeFun D $FR4
133 ComputeFun D $FS1
134 ComputeFun D $FS2
135 ComputeFun D $FS3
136 ComputeFun D $FS4
137 erase
138 GetShape D $FS4:2 Box1
139
140
141 #8 recomputation of entities of the TestSelection commands
142 SolveFlatFrom D $SL
143 NewCommand D
144