Tag Archives: 3D Printing

Creating a filleted cylinder in OpenSCAD


The following OpenSCAD module will create a filleted cylinder that can be used in your 3D print project when stronger sheering structural support is required.

Basically it uses rotate_extrude() on a circle to form a donut which will be used later as a cut out operation using the difference() on the smaller cylinder at the base. The fillets will be joined together using union() to form a solid filleted cylinder for the final result. At the moment, the top and bottom fillet radius can individually specified and will be used if it is greater than 0.

Here is an example of how the module can be used:

klam_fillet_cylinder(5, 1, 2, 1, 50);
translate([10,0,0]) klam_fillet_cylinder(10, 1, 0, 1, 50);
translate([-10,0,0]) klam_fillet_cylinder(10, 1, 2, 0, 50);

Constructed fillet cylinders:

filleted_cylinder

module klam_fillet_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);
            }
        }
    }
}

Advertisements