1 # Sample: creation of simple twist drill bit
5 pload MODELING VISUALIZATION
7 # drill parameters (some terms taken from http://www.drill-bits.cn/drill-bits-quality.asp)
8 dset R 4. ;# outer radius
10 dset Rr 3.5 ;# chisel radius (outer radius minus body clearance)
12 dset b 1. ;# web thickness (approximate)
15 dset H 80. ;# height of the spiral part
16 dset a 3.*pi ;# total angle of spiral rotation
18 dset sigma 118 ;# point angle, in degrees
20 # Create section profile by sequence of Boolean operations
21 # on simple planar objects
22 puts "Creating the drill section profile..."
24 polyline rectangle1 d -R 0 R -R 0 -d R 0 -R R 0 d -R 0
26 circle circle1 0 0 0 0 0 1 R
27 mkedge circle1 circle1
30 circle circle2 0 0 0 0 0 1 Rr
31 mkedge circle2 circle2
35 mkface rectangle1 p0 rectangle1
36 mkface circle1 p0 circle1
37 mkface circle2 p0 circle2
39 bcommon sec rectangle1 circle1
43 # Construct flute profile so as to have cutting lip straight after sharpening.
44 # Here we need to take into account spiral shift of the flute edge
45 # along the point length -- the way to do that is to make spiral
46 # from the desired cutting lip edge and then intersect it by plane
47 polyline lip d -d/2 0 d -R -R/tan(sigma/2*pi/180)
49 polyline sp 0 0 0 0 0 H
50 cylinder cc 0 0 0 0 0 1 0 -4 0 4
52 trim ll ll 0 sqrt(a*a+H*H)
56 trotate v2 0 0 0 0 0 1 180.*a/pi
65 mkface f0 p0 -R R -R R
66 bsection sflute spiral f0
68 # here we rely on that section curve is parameterized from 0 to 1
69 # and directed as cutting lip edge;
70 # note that this can change if intersection algorithm is modified
72 mkcurve cflute sflute_1
73 cvalue cflute 0. x0 y0 z0
74 cvalue cflute 1. x1 y1 z1
78 # -- variant: replace curve by arc with start at x0,y0,z0 and end at x1,y1,z1,
79 # -- such that tangent at start point is along Y
80 #dset Rflute ((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0))/(2*(x1-x0))
81 #circle aflute x0+Rflute y0 0 0 0 1 Rflute
82 #mkedge sflute_1 aflute vf0 vf1
84 # make rounding in the flute; use circle with radius Rr/2
85 circle cround x0+Rr/2 y0 0 0 0 1 Rr/2
87 mkedge sflute_2 cround vf3 vf0
91 wire w2 sflute_1 sflute_2 sflute_3 sflute_4
94 # cut flute from profile
96 trotate flute 0 0 0 0 0 1 180.
100 # sweep profile to get a drill body
101 puts "Sweeping the profile..."
109 # sharpen the drill (see http://tool-land.ru/zatochka-sverla.php)
112 dset theta a*R/H*sin((90-sigma/2)*pi/180)
113 plane ax1 d 1.9*D "H+1.9*D/tan(pi/180.*sigma/2.)" 0 -1 -1
114 pcone sh1 ax1 0 100*sin((sigma-90)/2*pi/180.) 100
115 trotate sh1 0 0 0 0 0 1 -theta*180/pi
117 trotate sh2 0 0 0 0 0 1 180
118 box sh -D/2 -D/2 72 D D 20
122 bcut body base sharpener
125 puts "Making a shank..."
126 plane pl2 0 0 -40 0 0 1
127 pcylinder shank pl2 4 40
129 plane pl3 0 0 -40 0 0 -0.5
130 pcone tail pl3 R 0 0.5
131 bfuse shank shank tail
132 bfuse shank shank transit
133 bfuse drill body shank
139 puts "Displaying result..."
143 vrenderparams -msaa 8
146 # show section and sweep path
147 ttranslate sec_1 0 0 H; trotate sec_1 0 0 0 0 0 1 a*180/pi; incmesh gg 0.01; vdisplay gg sec_1