1# ============= OCAF ============================
2# Naming
3#
4# Testing purpose: Naming selection mechanism
5#
6# Test case: F3 (ShapeOrientation is not used)
7#
8# 1.  Create Box $B1
9# 2.  Create sphere $Sph0
10# 3.  Create sphere $Sph1 and move it along XYZ
11# 4.  Create sphere $Sph2 and move it along XYZ
12# 5.  Create sphere $Sph3 and rotate it around line and move after  along XYZ
13# 6.  Create sphere $Sph4 and move it along XYZ
14# 7.  Cut spheres: $Cut1 = Cut($Sph0, $Sph1)
15# 		   $Cut2 = Cut($Sph0, $Sph2)
16#		   $Cut3 = Cut($Sph0, $Sph3)
17#		   $Cut4 = Cut($Sph0, $Sph4)
18# 8.  Make selection for all sub-shapes
19# 9.  Modify B2
20# 10. Recompute modeling functions
21# 11. Recompute selections
22# ===============================================
23
24erase
25Close D
26
27NewDocument D BinOcaf
28isos 12
29#1 - create Box using short-cut
30NewCommand D
31AddDriver D Box;			## add box driver to driver table
32set B1 [AddBox D 130 140 150];		## add box
33ComputeFun D $B1:1;			## compute box1 function
34GetShape D $B1:1:2 Box1;		## check result
35whatis Box1
36# refers to result NS
37GetReference D $B1;			## check is reference set
38
39
40#2 - create main sphere Sp0
41AddDriver D Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
42NewCommand D
43explode Box1 V
44set SPnt1 [AttachShape D Box1_1 ${B1} ${B1} 0]; ## set attachment
45erase Box1
46
47set Sph0 [AddSphere D $SPnt1 250]
48ComputeFun D $Sph0:1
49GetShape D $Sph0:1:2 Sp0
50
51#3 create Sphere1
52NewCommand D
53set Sph1 [AddSphere D $SPnt1 30]
54ComputeFun D $Sph1:1
55GetShape D $Sph1:1:2 Sp1
56
57NewCommand D
58set FTr1 [PTranslateDXYZ D $Sph1 0 -251 0]
59ComputeFun D $FTr1
60GetShape D $Sph1:2:2 Sp1
61
62#4 create Sphere2
63NewCommand D
64set Sph2 [AddSphere D $SPnt1 30]
65ComputeFun D $Sph2:1
66GetShape D $Sph2:1:2 Sp2
67
68set FTr2 [PTranslateDXYZ D $Sph2 0 251 0]
69ComputeFun D $FTr2
70GetShape D $Sph2:2:2 Sp2
71
72#5 create Sphere3
73NewCommand D
74set Sph3 [AddSphere D $SPnt1 30]
75ComputeFun D $Sph3:1
76GetShape D $Sph3:1:2 Sp3
77
78explode Box1 E
79set Sel3 [AttachShape D Box1_1 ${B1} ${B1} 0];
80set FR3 [PRotateRoundLine D $Sph3 $Sel3 120]
81ComputeFun D $FR3
82GetShape D $FR3:2 Sp3
83
84set FTr3 [PTranslateDXYZ D $Sph3 -251 0 0]
85ComputeFun D $FTr3
86GetShape D $Sph3:3:2 Sp3
87
88#6 create Sphere4
89NewCommand D
90set Sph4 [AddSphere D $SPnt1 30]
91ComputeFun D $Sph4:1
92GetShape D $Sph4:1:2 Sp4
93
94set FTr4 [PTranslateDXYZ D $Sph4  251 -40 0]
95ComputeFun D $FTr4
96GetShape D $Sph4:2:2 Sp4
97
98#7 Cut spheres
99set Cut1 [AddCut D $Sph0 $Sph1]
100ComputeFun D $Cut1
101GetShape D $Cut1:2 Sp0
102
103set Cut2 [AddCut D $Sph0 $Sph2]
104ComputeFun D $Cut2
105GetShape D $Cut2:2 Sp0
106
107set Cut3 [AddCut D $Sph0 $Sph3]
108ComputeFun D $Cut3
109GetShape D $Cut3:2 Sp0
110
111set Cut4 [AddCut D $Sph0 $Sph4]
112ComputeFun D $Cut4
113GetShape D $Cut4:2 Sp0
114
115
116#8 test selection
117NewCommand D
118set SL  [TestSingleSelection   D $Sph0 0]
119set SL2 [TestMultipleSelection D $Sph0 0]
120
121#9 modification
122NewCommand D
123BoxDZ D $B1 270
124
125#10 recomputation
126NewCommand D
127InitLogBook D;		## to be initialized before any recomputation of impacted functions set (if attachments are presented)
128ComputeFun D $B1:1
129ComputeFun D $SPnt1:1
130ComputeFun D $Sph0:1
131ComputeFun D $Sph1:1
132ComputeFun D $FTr1
133ComputeFun D $Sph2:1
134ComputeFun D $FTr2
135ComputeFun D $Sph3:1
136ComputeFun D $Sel3:1
137ComputeFun D $FR3
138ComputeFun D $FTr3
139ComputeFun D $Sph4:1
140ComputeFun D $FTr4
141ComputeFun D $Cut1
142ComputeFun D $Cut2
143ComputeFun D $Cut3
144ComputeFun D $Cut4
145erase
146GetShape D $Cut4:2 Sp0
147
148
149#11 recomputation of entities of the TestSelection commands
150SolveFlatFrom D $SL
151NewCommand D
152
153