36 lines
1.2 KiB
OpenSCAD
36 lines
1.2 KiB
OpenSCAD
|
module filleted_cylinder(
|
||
|
cylinder_height=2,
|
||
|
cylinder_radius=1,
|
||
|
fillet_radius_bottom=1,
|
||
|
fillet_radius_top=0,
|
||
|
nfaces=50
|
||
|
) {
|
||
|
/* created by Kevin Lam on Dec 3, 2016 */
|
||
|
union() {
|
||
|
cylinder(cylinder_height, r=cylinder_radius, $fn=nfaces, false);
|
||
|
|
||
|
if (fillet_radius_bottom > 0) {
|
||
|
difference() {
|
||
|
cylinder(fillet_radius_bottom, r=cylinder_radius+fillet_radius_bottom, $fn=nfaces, false);
|
||
|
translate([0, 0, fillet_radius_bottom])
|
||
|
rotate_extrude($fn=nfaces)
|
||
|
translate([cylinder_radius+fillet_radius_bottom, 0, 0])
|
||
|
circle(fillet_radius_bottom, $fn=nfaces);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (fillet_radius_top>0) {
|
||
|
difference() {
|
||
|
translate([0,0,cylinder_height-fillet_radius_top])
|
||
|
cylinder(fillet_radius_top, r=cylinder_radius+fillet_radius_top, $fn=nfaces, false);
|
||
|
|
||
|
translate([0, 0, cylinder_height-fillet_radius_top])
|
||
|
rotate_extrude($fn=nfaces)
|
||
|
translate([cylinder_radius+fillet_radius_top, 0, 0])
|
||
|
circle(fillet_radius_top, $fn=nfaces);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|