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