5 ###########################################
6 # Destructive results of simplification with DRAW command 'unifysamedom' after intersection of two complex models
7 ###########################################
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
16 set aPrismHeight [expr $aModelHeight - $aPlatformHeight]
17 set aPrismXOffset [expr $aPlatformLength - $aPrismLength - 69.75]
18 set aPrismYOffset [expr ($aPlatformWidth - $aPrismWidth)/2]
20 #================================================================================
22 box _platform $aPlatformLength $aPlatformWidth $aPlatformHeight
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
31 ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] $aScrewHoleOffset 0
32 bcut _platform _platform _screwhole
34 ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] [expr $aPlatformWidth - $aScrewHoleOffset] 0
35 bcut _platform _platform _screwhole
37 ttranslate _screwhole $aScrewHoleOffset [expr $aPlatformWidth - $aScrewHoleOffset] 0
38 bcut _platform _platform _screwhole
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
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
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
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
75 prism t_s t_f 0 $aCaveDepth 0
76 bcut _platform _platform t_s
79 set aFCaveCirclesRadius 4.65
80 set aFCaveBottomWidth 37.8
81 set aFCaveHeight 38.75
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
89 lintan t_l t_circle1 t_circle2
90 trim t_side1 t_l_1 0 $aFCaveTopWidth
92 lintan t_l t_circle2 t_circle3
93 trim t_side2 t_l_1 0 39.058577803089555
95 lintan t_l t_circle3 t_circle4
96 trim t_side3 t_l_1 0 $aFCaveBottomWidth
98 lintan t_l t_circle4 t_circle1
99 trim t_side4 t_l_1 0 39.196587861700415
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
106 plane t_plane 0 0 0 1 0 0 0 1 0
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
117 mkedge t_e1 t_circle1
119 mkedge t_e3 t_circle2
121 mkedge t_e5 t_circle3
123 mkedge t_e7 t_circle4
126 wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6 t_e7 t_e8
128 prism t_s1 t_f -$aCaveDepth 0 0
130 circle t_circle 0 [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] 0 1 0 0 $aFCaveSmallCircleRadius
134 prism t_s2 t_f [expr -$aCaveDepth/2] 0 0
136 box t_s3 0 0 -$aFCaveSmallCircleRadius [expr -$aCaveDepth/2] [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] [expr $aFCaveSmallCircleRadius*2]
140 bfuse _frontcave t_s1 t_s2
141 unifysamedom _frontcave _frontcave
143 # Cut this cave from the platform
144 ttranslate _frontcave $aPlatformLength [expr $aPlatformWidth*2/3] [expr $aPlatformHeight/2]
145 bcut _platform _platform _frontcave
147 tmirror _frontcave $aPlatformLength [expr $aPlatformWidth/2] [expr $aPlatformHeight/2] 0 1 0
148 bcut _platform _platform _frontcave
150 #================================================================================
151 # A wedge on the platform
152 box t_box $aPrismXOffset $aPrismYOffset $aPlatformHeight $aPrismLength $aPrismWidth $aPrismHeight
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
157 bcut _prism t_box _cutwedge
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]
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]
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}
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
179 blend t_cyl t_cyl 3 t_cyl_1
180 bfuse _prism _prism t_cyl
181 unifysamedom _prism _prism
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
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
193 # Fuse the platform and the prism
194 bfuse _model _platform _prism
196 # Make a pass-through hole
197 set aWedgeHoleInnerRadius 38.77
198 set aWedgeHoleOuterRadius 58.13
199 set aWedgeHoleBottomInnerRadius 50.38
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
208 ttranslate t_cyl2 0 0 10
209 ttranslate t_cyl3 0 0 20
210 ttranslate t_cyl4 0 0 [expr $aModelHeight - 10]
212 bfuse _cutCylindricShape t_cyl1 t_cyl2
213 bfuse _cutCylindricShape _cutCylindricShape t_cyl3
214 bfuse _cutCylindricShape _cutCylindricShape t_cyl4
216 bcut _model _model _cutCylindricShape
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
223 lintan t_l t_circle1 t_circle2
224 trim t_line12 t_l_2 0 48.050000000000004
226 lintan t_l t_circle2 t_circle3
227 trim t_line23 t_l_3 0 96.099999999999994
229 lintan t_l t_circle3 t_circle1
230 trim t_line31 t_l_4 0 48.050000000000004
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
238 plane t_plane [expr $aPrismXOffset + 77.5] [expr $aPrismYOffset + $aPrismWidth] [expr $aPlatformHeight + 57.35] 0 1 0 -1 0 0
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
247 mkedge t_e1 t_circle1
249 mkedge t_e3 t_circle3
251 mkedge t_e5 t_circle2
254 wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6
256 prism t_s t_f 0 $aCaveDepth 0
258 bfuse _model _model t_s
260 ############# Analyse #############
263 trotate _copy $aWedgeHoleXPos $aWedgeHoleYPos 0 0 0 1 90
264 bcommon res _model _copy
271 checktrinfo r -defl 0.04 -tol_abs_defl 0.01 -tol_rel_defl 0.01
277 checkview -screenshot -3d -path ${imagedir}/${test_image}.png