0031939: Coding - correction of spelling errors in comments [part 7]
[occt.git] / tests / caf / named_shape / F1
1 # ============= OCAF ============================
2 # Naming
3 #
4 # Testing purpose: Naming selection mechanism 
5 #
6 # Test case: F1 (ShapeOrientation is not used)
7 #
8 # 1.  Create Box B2
9 # 2.  Create cylinder $Cyl
10 # 3.  Translate $Cyl along XYZ
11 # 4.  $CS = Cut ($B2, $Cyl)
12 # 5.  Create 4 points as attachments of box $B2
13 # 6.  Create 4 spheres ($Sph1, $Sph2, $Sph9, $Sph11)
14 # 7.  Rotate spheres $Sph1, $Sph2 around line
15 # 8.  Fuse all spheres with box B2
16 # 9.  Make selection for all sub-shapes
17 # 10. Modify B2
18 # 11. Recompute modeling functions
19 # 12. Recompute selections
20 # ===============================================
21
22 erase 
23 Close D 
24
25 NewDocument D BinOcaf
26 AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
27
28 #1 Create Box
29 NewCommand D
30 set B2 [AddObject D];                   ## add object
31 set F2 [AddFunction D $B2 Box];         ## add function
32 BoxDX D $B2 190;                        ## set arguments of this function
33 BoxDY D $B2 290
34 BoxDZ D $B2 390
35 InitLogBook D;                          ## initialize (clean) internal maps of labels
36 ComputeFun D $F2;                       ## compute the function
37 GetShape D $F2:2 Box2;                  ## check result
38 whatis Box2
39 GetReference D $B2
40
41 #2 Create Cylinder
42 NewCommand D
43 explode Box2 F
44 explode Box2_1 E
45 set Sel1 [AttachShape D Box2_1_1 ${B2} ${B2} 1]; ## set attachment
46 ## AddDriver D Attach Cyl
47 set Cyl [AddCyl D 50 515 ${Sel1}]
48 ComputeFun D $Cyl:1
49 GetShape D $Cyl:1:2 CylS
50
51 #3 Translate Cylinder
52 NewCommand D
53 set FTr1 [PTranslateDXYZ D $Cyl 100 0 0]
54 ComputeFun D $FTr1
55 GetShape D $Cyl:2:2 CylS
56
57 #4 Cut Box Cyl
58 NewCommand D
59 set CS [AddCut D $B2 $Cyl]
60 ComputeFun D $CS
61 erase
62 GetShape D $CS:2 S
63 don S
64 NewCommand D
65
66 #5 set attachments - vertexes
67 explode S V
68 set SPnt1 [AttachShape D S_1 ${B2} ${B2} 0]; ## set attachment
69 set SPnt2 [AttachShape D S_2 ${B2} ${B2} 0]; ## set attachment
70 set SPnt9 [AttachShape D S_9 ${B2} ${B2} 0]; ## set attachment
71 set SPnt11 [AttachShape D S_11 ${B2} ${B2} 0]; ## set attachment
72
73
74 #6 create 4 Spheres
75 set Sph1 [AddSphere D $SPnt1 15]
76 ComputeFun D $Sph1:1
77 GetShape D $Sph1:1:2 Sp1
78
79 set Sph2 [AddSphere D $SPnt2 15]
80 ComputeFun D $Sph2:1
81 GetShape D $Sph2:1:2 Sp2
82
83 set Sph9 [AddSphere D $SPnt9 15]
84 ComputeFun D $Sph9:1
85 GetShape D $Sph9:1:2 Sp9
86
87 set Sph11 [AddSphere D $SPnt11 15]
88 ComputeFun D $Sph11:1
89 GetShape D $Sph11:1:2 Sp11
90
91 #7
92 explode Box2 E
93 set Sel61 [AttachShape D Box2_1 ${B2} ${B2} 0];
94 set FR1 [PRotateRoundLine D $Sph1 $Sel61 120]
95 ComputeFun D $FR1 
96 GetShape D $FR1:2 Sp1
97
98 set Sel62 [AttachShape D Box2_1 ${B2} ${B2} 0];
99 set FR2 [PRotateRoundLine D $Sph2 $Sel62 120]
100 ComputeFun D $FR2
101 GetShape D $FR2:2 Sp2
102
103 #8 Fuse 4 spheres
104 set FS1 [AddFuse D $B2 $Sph1]
105 ComputeFun D $FS1
106 GetShape D $FS1:2 S
107
108 set FS2 [AddFuse D $B2 $Sph2]
109 ComputeFun D $FS2
110 GetShape D $FS2:2 S
111
112
113 set FS9 [AddFuse D $B2 $Sph9]
114 ComputeFun D $FS9
115 GetShape D $FS9:2 S
116
117 set FS11 [AddFuse D $B2 $Sph11]
118 ComputeFun D $FS11
119 GetShape D $FS11:2 S
120
121
122 #9 test Naming
123 set SL [TestSingleSelection D $B2 0]    
124 set SL2 [TestMultipleSelection D $B2 0]
125
126 #10 Modification
127 NewCommand D
128 BoxDX D $B2 250
129 BoxDZ D $B2 310
130
131 #11 recompute
132 NewCommand D
133 InitLogBook D
134 ComputeFun D $F2
135 ComputeFun D $Sel1:1
136 ComputeFun D $Cyl:1
137 ComputeFun D $FTr1
138 ComputeFun D $CS
139 ComputeFun D $SPnt1:1
140 ComputeFun D $SPnt2:1
141 #ComputeFun D $SPnt5:1
142 #ComputeFun D $SPnt6:1
143 #ComputeFun D $SPnt7:1
144 ComputeFun D $SPnt9:1
145 ComputeFun D $SPnt11:1
146 #ComputeFun D $SPnt12:1
147 ComputeFun D $Sph1:1
148 ComputeFun D $Sph2:1
149 ComputeFun D $Sel61:1
150 ComputeFun D $FR1 
151 ComputeFun D $Sel62:1
152 ComputeFun D $FR2 
153 #ComputeFun D $Sph5:1 ## because 5,6,7,12 gives NOT VALID result
154 #ComputeFun D $Sph6:1
155 #ComputeFun D $Sph7:1
156 ComputeFun D $Sph9:1
157 ComputeFun D $Sph11:1
158 #ComputeFun D $Sph12:1
159 ComputeFun D $FS1
160 ComputeFun D $FS2
161 ComputeFun D $FS9
162 ComputeFun D $FS11
163 erase
164 GetShape D $FS11:2 S
165
166 #12
167 SolveFlatFrom D $SL
168 NewCommand D
169