07b5cb8f |
1 | puts "===========" |
2 | puts "OCC24758" |
3 | puts "===========" |
4 | puts "" |
5 | ############################################################## |
6 | # Sample Draw scripts for demonstrating sweeping algorithm |
7 | ############################################################## |
8 | |
9 | # parameters |
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 |
13 | |
14 | # make profile |
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 |
19 | |
20 | proc _curvetoface {name} { |
21 | uplevel #0 mkedge $name $name |
22 | uplevel #0 wire $name $name |
23 | uplevel #0 mkface $name p0 $name |
24 | } |
25 | |
26 | plane p0 |
27 | _curvetoface outer |
28 | _curvetoface inner |
29 | _curvetoface round |
30 | mkface cut p0 cut |
31 | |
32 | bcommon teeth cut round |
33 | bcommon teeth teeth outer |
34 | |
35 | tcopy inner profile |
36 | set nbteeths 25 |
37 | for {set i 0} {$i < $nbteeths} {incr i} { |
efac1733 |
38 | bfuse profile profile teeth |
07b5cb8f |
39 | trotate teeth 0 0 0 0 0 1 360./$nbteeths |
40 | } |
efac1733 |
41 | unifysamedom profile profile |
07b5cb8f |
42 | |
43 | # sweep profile along curved shape |
44 | polyline sp 0 0 0 0 0 H |
45 | cylinder ss 0 0 0 0 0 1 1 0 0 R |
46 | vertex v1 R 0 0 |
47 | vertex v2 R 0 H |
48 | line ll 0 0 a H |
49 | trim ll ll 0 sqrt(a*a+H*H) |
50 | |
51 | trotate v2 0 0 0 0 0 1 180.*a/pi |
52 | mkedge ee ll ss v1 v2 |
53 | wire gg ee |
54 | |
55 | donly profile sp gg |
56 | explode profile w |
57 | tcopy profile_1 profile_2 |
58 | tcopy profile_1 profile_3 |
59 | tscale profile_1 0 0 0 1./(R-2) |
60 | ttranslate profile_2 0 0 H/2 |
61 | tscale profile_2 0 0 H/2 4./(R-2) |
62 | ttranslate profile_3 0 0 H |
63 | tscale profile_3 0 0 H 3./(R-2) |
64 | |
65 | mksweep sp |
66 | setsweep -G gg 0 0 |
67 | addsweep profile_1 |
68 | addsweep profile_2 |
69 | addsweep profile_3 |
70 | vclear |
71 | |
72 | buildsweep base -S |
73 | |
74 | # make a shank |
75 | plane p1 0 0 H 0 0 1 |
76 | pcylinder shank p1 1.4 H |
77 | plane p2 0 0 H+1 0 0 1 |
78 | pcylinder sh2 p2 1.5 H-1 |
79 | bfuse shank shank sh2 |
80 | bfuse cutter base shank |
81 | |
82 | # check result |
83 | checkshape cutter |
84 | |
85 | # show result |
86 | incmesh cutter 0.01 |
87 | vinit |
88 | vdisplay cutter |
89 | vsetdispmode cutter 1 |
90 | incmesh profile_1 0.01; vdisplay profile_1 |
91 | vfit |
92 | |
58cf74e0 |
93 | # check area |
07b5cb8f |
94 | renamevar cutter result |
58cf74e0 |
95 | checkprops result -s 1403.85 |
96 | checkshape result |
07b5cb8f |
97 | |
5747059b |
98 | checkview -screenshot -3d -path ${imagedir}/${test_image}.png |