5 ##############################################################
6 # Sample Draw scripts for demonstrating sweeping algorithm
7 ##############################################################
10 dset R 10. ;# outer radius
11 dset H 20. ;# height of the spiral part
12 dset a 0.5*pi ;# total angle of spiral rotation
15 circle outer 0 0 0 0 0 1 R
16 circle inner 0 0 0 0 0 1 R-2
17 circle round 3 6 0 0 0 1 5
18 polyline cut -2 0 0 -2 R+1 0 0.5 R+1 0 -1 0 0 -2 0 0
20 proc _curvetoface {name} {
21 uplevel #0 mkedge $name $name
22 uplevel #0 wire $name $name
23 uplevel #0 mkface $name p0 $name
32 bcommon teeth cut round
33 bcommon teeth teeth outer
37 for {set i 0} {$i < $nbteeths} {incr i} {
38 fuse profile profile teeth
39 trotate teeth 0 0 0 0 0 1 360./$nbteeths
42 # sweep profile along curved shape
43 polyline sp 0 0 0 0 0 H
44 cylinder ss 0 0 0 0 0 1 1 0 0 R
48 trim ll ll 0 sqrt(a*a+H*H)
50 trotate v2 0 0 0 0 0 1 180.*a/pi
56 tcopy profile_1 profile_2
57 tcopy profile_1 profile_3
58 tscale profile_1 0 0 0 1./(R-2)
59 ttranslate profile_2 0 0 H/2
60 tscale profile_2 0 0 H/2 4./(R-2)
61 ttranslate profile_3 0 0 H
62 tscale profile_3 0 0 H 3./(R-2)
75 pcylinder shank p1 1.4 H
76 plane p2 0 0 H+1 0 0 1
77 pcylinder sh2 p2 1.5 H-1
79 bfuse cutter base shank
89 incmesh profile_1 0.01; vdisplay profile_1
93 renamevar cutter result