6a4e139fedacfd411c30d4c08545b02dd60a8f60
[occt.git] / tests / bugs / heal / bug26244
1 puts "=========="
2 puts "OCC26244"
3 puts "=========="
4 puts ""
5 ###########################################
6 # Destructive results of simplification with DRAW command 'unifysamedom' after intersection of two complex models
7 ###########################################
8
9 set my_pi 3.1415926535897931
10 set aModelHeight 178.25
11 set aPlatformLength 426.25
12 set aPlatformWidth 201.5
13 set aPlatformHeight 58.9
14 set aPrismLength 279
15 set aPrismWidth 155
16 set aPrismHeight [expr $aModelHeight - $aPlatformHeight]
17 set aPrismXOffset [expr $aPlatformLength - $aPrismLength - 69.75]
18 set aPrismYOffset [expr ($aPlatformWidth - $aPrismWidth)/2]
19
20 #================================================================================
21 # A base of the model
22 box _platform $aPlatformLength $aPlatformWidth $aPlatformHeight
23
24 # Make screw holes on the platform
25 set aScrewHoleRadius [expr 26.2/2]
26 set aScrewHoleOffset 31
27 pcylinder _screwhole $aScrewHoleRadius $aPlatformHeight
28 ttranslate _screwhole $aScrewHoleOffset $aScrewHoleOffset 0
29 bcut _platform _platform _screwhole
30 reset _screwhole
31 ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] $aScrewHoleOffset 0
32 bcut _platform _platform _screwhole
33 reset _screwhole
34 ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] [expr $aPlatformWidth - $aScrewHoleOffset] 0
35 bcut _platform _platform _screwhole
36 reset _screwhole
37 ttranslate _screwhole $aScrewHoleOffset [expr $aPlatformWidth - $aScrewHoleOffset] 0
38 bcut _platform _platform _screwhole
39 reset _screwhole
40
41 # Back side cave
42 set aCaveLength 81.38
43 set aCaveDepth 10
44 set aCaveWidth 19.38
45 set aBottomLevel [expr $aPlatformHeight/2 - $aCaveWidth/2]
46 set aTopLevel [expr $aPlatformHeight/2 + $aCaveWidth/2]
47 beziercurve t_bcurve 4  0 $aCaveLength $aBottomLevel  3  0 [expr $aCaveLength + $aCaveWidth/2] $aBottomLevel 6  0 [expr $aCaveLength + $aCaveWidth/2] $aTopLevel 6  0 $aCaveLength $aTopLevel 3
48 vertex t_v1 0 $aCaveLength $aBottomLevel
49 vertex t_v2 0 $aCaveLength $aTopLevel
50 mkedge t_e1 t_bcurve
51 edge t_e2 t_v1 t_v2
52 wire t_w t_e1 t_e2
53 mkplane t_f1 t_w
54 prism t_s1 t_f1 $aCaveDepth 0 0
55 box t_s2 0 0 $aBottomLevel $aCaveDepth $aCaveLength $aCaveWidth
56 bfuse _backcave t_s1 t_s2
57 bcut _platform _platform _backcave
58
59 # Right side cave
60 set aRCaveRadius 26.2
61 set aRCaveDistToSection 15.5
62 set aCurveParam [expr ($my_pi - acos($aRCaveDistToSection/$aRCaveRadius))]
63 set aRCaveCenterX [expr $aPlatformLength - 162.75]
64 set aRCaveCenterZ [expr $aPlatformHeight/2]
65 circle t_circle $aRCaveCenterX 0 $aRCaveCenterZ 0 1 0 1 0 0 $aRCaveRadius
66 trim t_curve t_circle -$aCurveParam $aCurveParam
67 mkedge t_e1 t_curve
68 cvalue t_curve -$aCurveParam t_x t_y t_z
69 vertex t_v1 t_x t_y t_z
70 cvalue t_curve $aCurveParam t_x t_y t_z
71 vertex t_v2 t_x t_y t_z
72 edge t_e2 t_v1 t_v2
73 wire t_w t_e1 t_e2
74 mkplane t_f t_w
75 prism t_s t_f 0 $aCaveDepth 0
76 bcut _platform _platform t_s
77
78 # Caves on front side
79 set aFCaveCirclesRadius 4.65
80 set aFCaveBottomWidth 37.8
81 set aFCaveHeight 38.75
82 set aFCaveTopWidth 27
83 set aFCaveSmallCircleRadius 9.3
84 circle t_circle1 [expr $aFCaveTopWidth/2] [expr $aFCaveHeight/2] $aFCaveCirclesRadius
85 circle t_circle2 [expr -$aFCaveTopWidth/2] [expr $aFCaveHeight/2] $aFCaveCirclesRadius
86 circle t_circle3 [expr -$aFCaveBottomWidth/2] [expr -$aFCaveHeight/2] $aFCaveCirclesRadius
87 circle t_circle4 [expr $aFCaveBottomWidth/2] [expr -$aFCaveHeight/2] $aFCaveCirclesRadius
88
89 lintan t_l t_circle1 t_circle2
90 trim t_side1 t_l_1 0 $aFCaveTopWidth
91
92 lintan t_l t_circle2 t_circle3
93 trim t_side2 t_l_1 0 39.058577803089555
94
95 lintan t_l t_circle3 t_circle4
96 trim t_side3 t_l_1 0 $aFCaveBottomWidth
97
98 lintan t_l t_circle4 t_circle1
99 trim t_side4 t_l_1 0 39.196587861700415
100
101 trim t_circle1 t_circle1 0.15109758878146562 1.5707963267948966 
102 trim t_circle2 t_circle2 1.5707963267948966 3.0158086349284448
103 trim t_circle3 t_circle3 3.0158086349284448 4.7123889803846897 
104 trim t_circle4 t_circle4 4.7123889803846897 0.15109758878146562 
105
106 plane t_plane 0 0 0 1 0 0 0 1 0
107
108 to3d t_circle1 t_circle1 t_plane
109 to3d t_circle2 t_circle2 t_plane
110 to3d t_circle3 t_circle3 t_plane
111 to3d t_circle4 t_circle4 t_plane
112 to3d t_side1 t_side1 t_plane
113 to3d t_side2 t_side2 t_plane
114 to3d t_side3 t_side3 t_plane
115 to3d t_side4 t_side4 t_plane
116
117 mkedge t_e1 t_circle1
118 mkedge t_e2 t_side1
119 mkedge t_e3 t_circle2
120 mkedge t_e4 t_side2
121 mkedge t_e5 t_circle3
122 mkedge t_e6 t_side3
123 mkedge t_e7 t_circle4
124 mkedge t_e8 t_side4
125
126 wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6 t_e7 t_e8
127 mkplane t_f t_w
128 prism t_s1 t_f -$aCaveDepth 0 0
129
130 circle t_circle 0 [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] 0 1 0 0 $aFCaveSmallCircleRadius
131 mkedge t_e t_circle
132 wire t_w t_e
133 mkplane t_f t_w
134 prism t_s2 t_f [expr -$aCaveDepth/2] 0 0
135
136 box t_s3 0 0 -$aFCaveSmallCircleRadius  [expr -$aCaveDepth/2] [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] [expr $aFCaveSmallCircleRadius*2]
137
138 # Compile elements
139 bfuse t_s2 t_s2 t_s3
140 bfuse _frontcave t_s1 t_s2
141 unifysamedom _frontcave _frontcave
142
143 # Cut this cave from the platform
144 ttranslate _frontcave $aPlatformLength [expr $aPlatformWidth*2/3] [expr $aPlatformHeight/2]
145 bcut _platform _platform _frontcave
146
147 tmirror _frontcave $aPlatformLength [expr $aPlatformWidth/2] [expr $aPlatformHeight/2] 0 1 0
148 bcut _platform _platform _frontcave
149
150 #================================================================================
151 # A wedge on the platform
152 box t_box  $aPrismXOffset $aPrismYOffset $aPlatformHeight $aPrismLength $aPrismWidth $aPrismHeight
153
154 set aCutwedgeLength [expr $aPrismHeight/0.57735]
155 wedge _cutwedge $aPlatformLength [expr $aPrismYOffset + $aPrismWidth] $aModelHeight 0 -1 0 -1 0 0 $aCutwedgeLength $aPrismHeight $aPrismWidth 0
156
157 bcut _prism t_box _cutwedge
158
159 # Make 9 small holes on a top side
160 set aWedgeSmallHolesRadius 7.68
161 set aWedgeSmallHolesOrbit 67.81
162 set aWedgeHoleXPos [expr $aPrismXOffset + 77.5]
163 set aWedgeHoleYPos [expr $aPrismYOffset + 77.5]
164
165 plane t_plane $aWedgeHoleXPos $aWedgeHoleYPos [expr $aPlatformHeight + $aPrismHeight/2] 0 0 1 1 0 0
166 pcylinder t_cyl t_plane $aWedgeSmallHolesRadius [expr $aPrismHeight/2]
167
168 set i 2
169 while {$i <= 10} {ttranslate t_cyl [expr $aWedgeSmallHolesOrbit*cos($i*$my_pi/6)] [expr $aWedgeSmallHolesOrbit*sin($i*$my_pi/6)] 0; bcut _prism _prism t_cyl; reset t_cyl; incr i}
170
171 # Make a cylinder on a canted side
172 set aWedgeCylinderRadius 38.75
173 set aWedgeCylinderHeight 38.75
174 set aWedgeCantedHeight [expr tan($my_pi/6)*($aCutwedgeLength - 69.75)]
175 set aWedgeCylinderZPos [expr $aModelHeight - $aWedgeCantedHeight/2]
176 plane t_plane [expr $aPrismXOffset + $aPrismLength*3/4] [expr $aPrismYOffset + $aPrismWidth/2] $aWedgeCylinderZPos cos($my_pi/3) 0 sin($my_pi/3) 0 1 0
177 pcylinder t_cyl t_plane $aWedgeCylinderRadius $aWedgeCylinderHeight
178 explode t_cyl e
179 blend t_cyl t_cyl 3 t_cyl_1
180 bfuse _prism _prism t_cyl
181 unifysamedom _prism _prism
182
183 # Make a hole in the cylinder on the wedge
184 pcylinder t_cyl t_plane [expr $aWedgeCylinderRadius/2] 100
185 ttranslate t_cyl [expr -60*cos($my_pi/3)] 0 [expr -60*sin($my_pi/3)]
186 bcut _prism _prism t_cyl
187
188 # Make a hole on a right side of the wedge
189 plane t_plane [expr $aPlatformLength - 162.75] $aPrismYOffset [expr $aModelHeight - $aWedgeCantedHeight] 0 1 0 1 0 0
190 pcylinder t_cyl t_plane 13.1 [expr $aPrismWidth/2]
191 bcut _prism _prism t_cyl
192
193 # Fuse the platform and the prism
194 bfuse _model _platform _prism
195
196 # Make a pass-through hole
197 set aWedgeHoleInnerRadius 38.77
198 set aWedgeHoleOuterRadius 58.13
199 set aWedgeHoleBottomInnerRadius 50.38
200
201 # Cylinders from bottom to top
202 plane t_plane $aWedgeHoleXPos $aWedgeHoleYPos 0
203 pcylinder t_cyl1 t_plane $aWedgeHoleOuterRadius 10
204 pcylinder t_cyl2 t_plane $aWedgeHoleBottomInnerRadius 10
205 pcylinder t_cyl3 t_plane $aWedgeHoleInnerRadius [expr $aModelHeight - 30]
206 pcylinder t_cyl4 t_plane $aWedgeHoleOuterRadius 10
207
208 ttranslate t_cyl2 0 0 10
209 ttranslate t_cyl3 0 0 20
210 ttranslate t_cyl4 0 0 [expr $aModelHeight - 10]
211
212 bfuse _cutCylindricShape t_cyl1 t_cyl2
213 bfuse _cutCylindricShape _cutCylindricShape t_cyl3
214 bfuse _cutCylindricShape _cutCylindricShape t_cyl4
215
216 bcut _model _model _cutCylindricShape
217
218 # Add a block on left side
219 circle t_circle1 0 0 38.75
220 circle t_circle2 [expr 38.75 + 9.3] [expr -57.35 + 9.3] 9.3
221 circle t_circle3 [expr -38.75 - 9.3] [expr -57.35 + 9.3] 9.3
222
223 lintan t_l t_circle1 t_circle2
224 trim t_line12 t_l_2 0 48.050000000000004
225
226 lintan t_l t_circle2 t_circle3
227 trim t_line23 t_l_3 0 96.099999999999994
228
229 lintan t_l t_circle3 t_circle1
230 trim t_line31 t_l_4 0 48.050000000000004
231
232 trim t_circle1 t_circle1 0 $my_pi
233 trim t_circle2 t_circle2 $my_pi 4.7123889803846897
234 trim t_circle3 t_circle3 4.7123889803846897 6.2831853071795862
235
236 reverse t_circle1
237
238 plane t_plane [expr $aPrismXOffset + 77.5] [expr $aPrismYOffset + $aPrismWidth] [expr $aPlatformHeight + 57.35] 0 1 0 -1 0 0
239
240 to3d t_circle1 t_circle1 t_plane
241 to3d t_circle2 t_circle2 t_plane
242 to3d t_circle3 t_circle3 t_plane
243 to3d t_line12 t_line12 t_plane
244 to3d t_line23 t_line23 t_plane
245 to3d t_line31 t_line31 t_plane
246
247 mkedge t_e1 t_circle1
248 mkedge t_e2 t_line31
249 mkedge t_e3 t_circle3
250 mkedge t_e4 t_line23
251 mkedge t_e5 t_circle2
252 mkedge t_e6 t_line12
253
254 wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6
255 mkplane t_f t_w
256 prism t_s t_f 0 $aCaveDepth 0
257
258 bfuse _model _model t_s
259
260 ############# Analyse #############
261
262 tcopy _model _copy
263 trotate _copy $aWedgeHoleXPos $aWedgeHoleYPos 0 0 0 1 90
264 bcommon res _model _copy
265 checkshape res
266
267 unifysamedom r res
268 incmesh r 0.1
269 trinfo r
270
271 set info [trinfo r]
272 regexp { +([-0-9.+eE]+) +triangles} $info full tr
273 regexp { +([-0-9.+eE]+) +nodes} $info full nd
274 regexp { +([-0-9.+eE]+) +nodes} $info full nd
275 regexp {Maximal deflection +([-0-9.+eE]+)} $info full defl
276
277 set expected_defl 0.04
278 set tol_abs_defl 0.01
279 set tol_rel_defl 0.01
280 checkreal "Maximal deflection" ${defl} ${expected_defl} ${tol_abs_defl} ${tol_rel_defl}
281
282 vinit
283 vsetdispmode 1
284 vdisplay r
285 vfit
286 checkview -screenshot -3d -path ${imagedir}/${test_image}.png