0023639: Exception on attempt to save to XmlOcaf format
[occt.git] / tests / caf / named_shape / F6
1 # =================== OCAF ======================
2 # Naming
3 #
4 # Testing purpose: Naming selection mechanism 
5 #
6 # Test case: F6 (ShapeOrientation is not  used)
7 # 1.  Create 4 points: $Pnt1 - $Pnt4
8 # 2.  Create closed line $Lin2
9 # 3.  Create prism Pr ($Prism)
10 # 4.  Addbox $B1
11 # 5.  Translate box $B1 along XYZ
12 # 6.  $Com1 = Common ($Prism, $B1)
13 # 7.  Add cylinder $Cyl
14 # 8.  Translate cylinder $Cyl along XYZ
15 # 9.  Cut $Cut1 = Cut ($Prism, $Cyl)
16 # 10. Make  selections for all sub-shapes
17 # 11. Modify $Pnt1
18 # 12. Recompute modeling functions
19 # 13. Recompute selections
20 # ===============================================
21
22 erase 
23 Close D 
24
25 NewDocument D BinOcaf
26 isos 12
27
28 #1 - create 4 Pnts
29 NewCommand D
30 AddDriver D PntXYZ PntRLT Line3D Attach;
31 set Pnt1 [AddPoint D 0 0 0];            ## add point1
32 ComputeFun D $Pnt1:1;                   ## compute function
33 GetShape D $Pnt1:1:2 P1;                ## check result
34 whatis P1
35 # referes to result NS
36 GetReference D $Pnt1;                   ## check is reference set 
37
38 set Pnt2 [AddPoint D 0 200 0];
39 ComputeFun D $Pnt2:1;
40 set Pnt3 [AddPoint D 200 200 0];
41 ComputeFun D $Pnt3:1;
42 set Pnt4 [AddPoint D 200 0 0];
43 ComputeFun D $Pnt4:1;
44 GetShape D $Pnt2:1:2 P2;
45 GetShape D $Pnt3:1:2 P3;
46 GetShape D $Pnt4:1:2 P4;
47
48
49 #2 create closed Lin2
50 NewCommand D
51 set Lin2 [ AddLine3D D 1 $Pnt1 $Pnt2 $Pnt3 $Pnt4]
52 ComputeFun D $Lin2:1;
53 GetShape D $Lin2:1:2 L1;
54
55 #3 Prism  
56 NewCommand D
57 AddDriver D Prism Box PTxyz
58 set Prism [AddPrism D $Lin2 300 1]
59 ComputeFun D $Prism:1
60 GetShape D $Prism:1:2 Pr
61 GetReference D $Prism;                  ## check is reference set 
62
63 #4 Add Box
64 NewCommand D
65 set B1 [AddBox D 400 140 600];
66 ComputeFun D $B1:1;
67 GetShape D $B1:1:2 Box;
68
69 #5 Translate Box1
70 NewCommand D
71 set FTr1 [PTranslateDXYZ D $B1 -100 -20 -100]
72 ComputeFun D $FTr1
73 GetShape D $B1:2:2 Box
74
75 #6 add Common
76 NewCommand D
77 AddDriver D Comm Cut Fuse
78 set Com1 [AddCommon D $Prism $B1]
79 ComputeFun D $Com1
80 GetShape D $Com1:2 Pr
81
82 #7 add Cylinder
83 NewCommand D
84 explode Pr E
85 AddDriver D Attach Cyl
86 set Sel1 [AttachShape D Pr_6 ${Prism} ${Prism} 0]; ## set attachment
87 set Cyl [AddCyl D 70 515 ${Sel1}]
88 ComputeFun D $Cyl:1
89 GetShape D $Cyl:1:2 CylS
90
91 #8 Translate Cylinder
92 NewCommand D
93 set FTr1 [PTranslateDXYZ D $Cyl -100 200 170]
94 ComputeFun D $FTr1
95 GetShape D $Cyl:2:2 CylS
96
97 #9 Cut Prism by Cylinder
98 set Cut1 [AddCut D $Prism $Cyl]
99 ComputeFun D $Cut1
100 GetShape D $Cut1:2 Pr
101 don Pr
102
103 #10 test selection
104 NewCommand D
105 set SL  [TestSingleSelection   D $Prism 0]
106 set SL2 [TestMultipleSelection D $Prism 0]
107
108
109
110 #11 modify
111 NewCommand D
112 PntOffset D $Pnt1  20 25 skip
113
114 #12 recompute
115 NewCommand D
116 ComputeFun D $Pnt1:1
117 ComputeFun D $Lin2:1
118 ComputeFun D $Prism:1
119 ComputeFun D $Com1
120 ComputeFun D $Sel1:1                                    
121 ComputeFun D $Cyl:1
122 ComputeFun D $FTr1
123 ComputeFun D $Cut1
124 erase
125 GetShape D $Cut1:2 Pr
126
127
128 #13 recomputation of entities of the TestSelection commands
129 SolveFlatFrom D $SL
130 NewCommand D
131