0031999: Tests - request Core Profile on macOS for Ray-Tracing tests
[occt.git] / samples / tcl / ANC101.tcl
CommitLineData
ba3d7cdf 1# The following example constructs ANC-101 object of CAM-I.
2#
3# This model was used as a test part for comparing modeling systems in 1979 and
4# again in 1983. The tests were organized by Computer Aided Manufacturing
5# International (CAM-I).
6#
7#Category: Modeling
8#Title: ANC101 (classic test for CAD modeling from CAM-I)
9
10pload MODELING
11
12set my_pi 3.1415926535897931
13set aModelHeight 178.25
14set aPlatformLength 426.25
15set aPlatformWidth 201.5
16set aPlatformHeight 58.9
17set aPrismLength 279
18set aPrismWidth 155
19set aPrismHeight [expr $aModelHeight - $aPlatformHeight]
20set aPrismXOffset [expr $aPlatformLength - $aPrismLength - 69.75]
21set aPrismYOffset [expr ($aPlatformWidth - $aPrismWidth)/2]
22
23#================================================================================
24# A base of the model
25box _platform $aPlatformLength $aPlatformWidth $aPlatformHeight
26
27# Make screw holes on the platform
28set aScrewHoleRadius [expr 26.2/2]
29set aScrewHoleOffset 31
30pcylinder _screwhole $aScrewHoleRadius $aPlatformHeight
31ttranslate _screwhole $aScrewHoleOffset $aScrewHoleOffset 0
32bcut _platform _platform _screwhole
33reset _screwhole
34ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] $aScrewHoleOffset 0
35bcut _platform _platform _screwhole
36reset _screwhole
37ttranslate _screwhole [expr $aPlatformLength - $aScrewHoleOffset] [expr $aPlatformWidth - $aScrewHoleOffset] 0
38bcut _platform _platform _screwhole
39reset _screwhole
40ttranslate _screwhole $aScrewHoleOffset [expr $aPlatformWidth - $aScrewHoleOffset] 0
41bcut _platform _platform _screwhole
42reset _screwhole
43
44# Back side cave
45set aCaveLength 81.38
46set aCaveDepth 10
47set aCaveWidth 19.38
48set aBottomLevel [expr $aPlatformHeight/2 - $aCaveWidth/2]
49set aTopLevel [expr $aPlatformHeight/2 + $aCaveWidth/2]
50beziercurve 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
51vertex t_v1 0 $aCaveLength $aBottomLevel
52vertex t_v2 0 $aCaveLength $aTopLevel
53mkedge t_e1 t_bcurve
54edge t_e2 t_v1 t_v2
55wire t_w t_e1 t_e2
56mkplane t_f1 t_w
57prism t_s1 t_f1 $aCaveDepth 0 0
58box t_s2 0 0 $aBottomLevel $aCaveDepth $aCaveLength $aCaveWidth
59bfuse _backcave t_s1 t_s2
60bcut _platform _platform _backcave
61
62# Right side cave
63set aRCaveRadius 26.2
64set aRCaveDistToSection 15.5
65set aCurveParam [expr ($my_pi - acos($aRCaveDistToSection/$aRCaveRadius))]
66set aRCaveCenterX [expr $aPlatformLength - 162.75]
67set aRCaveCenterZ [expr $aPlatformHeight/2]
68circle t_circle $aRCaveCenterX 0 $aRCaveCenterZ 0 1 0 1 0 0 $aRCaveRadius
69trim t_curve t_circle -$aCurveParam $aCurveParam
70mkedge t_e1 t_curve
71cvalue t_curve -$aCurveParam t_x t_y t_z
72vertex t_v1 t_x t_y t_z
73cvalue t_curve $aCurveParam t_x t_y t_z
74vertex t_v2 t_x t_y t_z
75edge t_e2 t_v1 t_v2
76wire t_w t_e1 t_e2
77mkplane t_f t_w
78prism t_s t_f 0 $aCaveDepth 0
79bcut _platform _platform t_s
80
81# Caves on front side
82set aFCaveCirclesRadius 4.65
83set aFCaveBottomWidth 37.8
84set aFCaveHeight 38.75
85set aFCaveTopWidth 27
86set aFCaveSmallCircleRadius 9.3
87circle t_circle1 [expr $aFCaveTopWidth/2] [expr $aFCaveHeight/2] $aFCaveCirclesRadius
88circle t_circle2 [expr -$aFCaveTopWidth/2] [expr $aFCaveHeight/2] $aFCaveCirclesRadius
89circle t_circle3 [expr -$aFCaveBottomWidth/2] [expr -$aFCaveHeight/2] $aFCaveCirclesRadius
90circle t_circle4 [expr $aFCaveBottomWidth/2] [expr -$aFCaveHeight/2] $aFCaveCirclesRadius
91
92lintan t_l t_circle1 t_circle2
93trim t_side1 t_l_1 0 $aFCaveTopWidth
94
95lintan t_l t_circle2 t_circle3
96trim t_side2 t_l_1 0 39.058577803089555
97
98lintan t_l t_circle3 t_circle4
99trim t_side3 t_l_1 0 $aFCaveBottomWidth
100
101lintan t_l t_circle4 t_circle1
102trim t_side4 t_l_1 0 39.196587861700415
103
104trim t_circle1 t_circle1 0.15109758878146562 1.5707963267948966
105trim t_circle2 t_circle2 1.5707963267948966 3.0158086349284448
106trim t_circle3 t_circle3 3.0158086349284448 4.7123889803846897
107trim t_circle4 t_circle4 4.7123889803846897 0.15109758878146562
108
109plane t_plane 0 0 0 1 0 0 0 1 0
110
111to3d t_circle1 t_circle1 t_plane
112to3d t_circle2 t_circle2 t_plane
113to3d t_circle3 t_circle3 t_plane
114to3d t_circle4 t_circle4 t_plane
115to3d t_side1 t_side1 t_plane
116to3d t_side2 t_side2 t_plane
117to3d t_side3 t_side3 t_plane
118to3d t_side4 t_side4 t_plane
119
120mkedge t_e1 t_circle1
121mkedge t_e2 t_side1
122mkedge t_e3 t_circle2
123mkedge t_e4 t_side2
124mkedge t_e5 t_circle3
125mkedge t_e6 t_side3
126mkedge t_e7 t_circle4
127mkedge t_e8 t_side4
128
129wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6 t_e7 t_e8
130mkplane t_f t_w
131prism t_s1 t_f -$aCaveDepth 0 0
132
133circle t_circle 0 [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] 0 1 0 0 $aFCaveSmallCircleRadius
134mkedge t_e t_circle
135wire t_w t_e
136mkplane t_f t_w
137prism t_s2 t_f [expr -$aCaveDepth/2] 0 0
138
139box t_s3 0 0 -$aFCaveSmallCircleRadius [expr -$aCaveDepth/2] [expr $aFCaveTopWidth/2 + $aFCaveBottomWidth/2] [expr $aFCaveSmallCircleRadius*2]
140
141# Compile elements
142bfuse t_s2 t_s2 t_s3
143bfuse _frontcave t_s1 t_s2
144unifysamedom _frontcave _frontcave
145
146# Cut this cave from the platform
147ttranslate _frontcave $aPlatformLength [expr $aPlatformWidth*2/3] [expr $aPlatformHeight/2]
148bcut _platform _platform _frontcave
149
150tmirror _frontcave $aPlatformLength [expr $aPlatformWidth/2] [expr $aPlatformHeight/2] 0 1 0
151bcut _platform _platform _frontcave
152
153#================================================================================
154# A wedge on the platform
155box t_box $aPrismXOffset $aPrismYOffset $aPlatformHeight $aPrismLength $aPrismWidth $aPrismHeight
156
157set aCutwedgeLength [expr $aPrismHeight/0.57735]
158wedge _cutwedge $aPlatformLength [expr $aPrismYOffset + $aPrismWidth] $aModelHeight 0 -1 0 -1 0 0 $aCutwedgeLength $aPrismHeight $aPrismWidth 0
159
160bcut _prism t_box _cutwedge
161
162# Make 9 small holes on a top side
163set aWedgeSmallHolesRadius 7.68
164set aWedgeSmallHolesOrbit 67.81
165set aWedgeHoleXPos [expr $aPrismXOffset + 77.5]
166set aWedgeHoleYPos [expr $aPrismYOffset + 77.5]
167
168plane t_plane $aWedgeHoleXPos $aWedgeHoleYPos [expr $aPlatformHeight + $aPrismHeight/2] 0 0 1 1 0 0
169pcylinder t_cyl t_plane $aWedgeSmallHolesRadius [expr $aPrismHeight/2]
170
171set i 2
172while {$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}
173
174# Make a cylinder on a canted side
175set aWedgeCylinderRadius 38.75
176set aWedgeCylinderHeight 38.75
177set aWedgeCantedHeight [expr tan($my_pi/6)*($aCutwedgeLength - 69.75)]
178set aWedgeCylinderZPos [expr $aModelHeight - $aWedgeCantedHeight/2]
179plane t_plane [expr $aPrismXOffset + $aPrismLength*3/4] [expr $aPrismYOffset + $aPrismWidth/2] $aWedgeCylinderZPos cos($my_pi/3) 0 sin($my_pi/3) 0 1 0
180pcylinder t_cyl t_plane $aWedgeCylinderRadius $aWedgeCylinderHeight
181explode t_cyl e
182blend t_cyl t_cyl 3 t_cyl_1
183bfuse _prism _prism t_cyl
184unifysamedom _prism _prism
185
186# Make a hole in the cylinder on the wedge
187pcylinder t_cyl t_plane [expr $aWedgeCylinderRadius/2] 100
188ttranslate t_cyl [expr -60*cos($my_pi/3)] 0 [expr -60*sin($my_pi/3)]
189bcut _prism _prism t_cyl
190
191# Make a hole on a right side of the wedge
192plane t_plane [expr $aPlatformLength - 162.75] $aPrismYOffset [expr $aModelHeight - $aWedgeCantedHeight] 0 1 0 1 0 0
193pcylinder t_cyl t_plane 13.1 [expr $aPrismWidth/2]
194bcut _prism _prism t_cyl
195
196# Fuse the platform and the prism
197bfuse _model _platform _prism
198
199# Make a pass-through hole
200set aWedgeHoleInnerRadius 38.77
201set aWedgeHoleOuterRadius 58.13
202set aWedgeHoleBottomInnerRadius 50.38
203
204# Cylinders from bottom to top
205plane t_plane $aWedgeHoleXPos $aWedgeHoleYPos 0
206pcylinder t_cyl1 t_plane $aWedgeHoleOuterRadius 10
207pcylinder t_cyl2 t_plane $aWedgeHoleBottomInnerRadius 10
208pcylinder t_cyl3 t_plane $aWedgeHoleInnerRadius [expr $aModelHeight - 30]
209pcylinder t_cyl4 t_plane $aWedgeHoleOuterRadius 10
210
211ttranslate t_cyl2 0 0 10
212ttranslate t_cyl3 0 0 20
213ttranslate t_cyl4 0 0 [expr $aModelHeight - 10]
214
215bfuse _cutCylindricShape t_cyl1 t_cyl2
216bfuse _cutCylindricShape _cutCylindricShape t_cyl3
217bfuse _cutCylindricShape _cutCylindricShape t_cyl4
218
219bcut _model _model _cutCylindricShape
220
221# Add a block on left side
222circle t_circle1 0 0 38.75
223circle t_circle2 [expr 38.75 + 9.3] [expr -57.35 + 9.3] 9.3
224circle t_circle3 [expr -38.75 - 9.3] [expr -57.35 + 9.3] 9.3
225
226lintan t_l t_circle1 t_circle2
227trim t_line12 t_l_2 0 48.05
228
229lintan t_l t_circle2 t_circle3
230trim t_line23 t_l_3 0 96.1
231
232lintan t_l t_circle3 t_circle1
233trim t_line31 t_l_4 0 48.05
234
235trim t_circle1 t_circle1 0 $my_pi
236trim t_circle2 t_circle2 $my_pi 4.7123889803846897
237trim t_circle3 t_circle3 4.7123889803846897 6.2831853071795862
238
239reverse t_circle1
240
241plane t_plane [expr $aPrismXOffset + 77.5] [expr $aPrismYOffset + $aPrismWidth] [expr $aPlatformHeight + 57.35] 0 1 0 -1 0 0
242
243to3d t_circle1 t_circle1 t_plane
244to3d t_circle2 t_circle2 t_plane
245to3d t_circle3 t_circle3 t_plane
246to3d t_line12 t_line12 t_plane
247to3d t_line23 t_line23 t_plane
248to3d t_line31 t_line31 t_plane
249
250mkedge t_e1 t_circle1
251mkedge t_e2 t_line31
252mkedge t_e3 t_circle3
253mkedge t_e4 t_line23
254mkedge t_e5 t_circle2
255mkedge t_e6 t_line12
256
257wire t_w t_e1 t_e2 t_e3 t_e4 t_e5 t_e6
258mkplane t_f t_w
259prism t_s t_f 0 $aCaveDepth 0
260
261bfuse _model _model t_s
262
263# Make fillets
264explode _model e
265
266# Make a weld at joint edges of platform and wedge
2674244c 267blend _model _model 2 _model_27
ba3d7cdf 268blend _model _model 2 _model_28
269blend _model _model 2 _model_29
9324aa2d 270blend _model _model 2 _model_30
271blend _model _model 2 _model_32
ba3d7cdf 272
273# Cylinder on wedge
274blend result _model 2 _model_161
275
276# Show result
277pload VISUALIZATION
278vinit Driver1/Viewer1/View1
aaf8d6a9 279vbackground -color C8C8FF
0493ffd0 280vdisplay -dispMode 1 result
ba3d7cdf 281vfit
0493ffd0 282vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2