7

Is there an easy way/function to round edges for an openscad object?

e.g. round the edges of the cylinders

Matthias Adriaens
  • 82
  • 1
  • 3
  • 12

5 Answers5

7

minkowski() is your friend for rounding over all edges of a geometry. minkowski() is also incredibly slow and should only be used for final rendering. You can also implement primitives which have rounded edges more efficiently with other constructs.

$fn=60;

module drawLedgeRing()
{
    difference()
    {
        cylinder(4,10,10);

        translate([0,0,-1])
        cylinder(4,6,6);

        translate([0,0,2])
        cylinder(4,8,8);
    }
}

minkowski()
{
    drawLedgeRing();
    sphere(.25);
}

//drawLedgeRing();
Community
  • 1
  • 1
Scott Leslie
  • 1,017
  • 8
  • 10
4

There are probably many ways to make a rounded cylinder. One way is to make 2 donut shaped objects and hull them

hull(){
rotate_extrude() translate([r1,0,0]) circle(r2);
rotate_extrude() translate([r1,0,h1]) circle(r2);
}
Don
  • 86
  • 6
4

I was looking for a radiused block to 3d print an instrument case. After reading the earlier answers I looked into hull (Not the town! :-) making 8 identical spheres at the corners of a block and hulling them looks good.

module radiusedblock(xlen,ylen,zlen,radius){
hull(){
translate([radius,radius,radius]) sphere(r=radius);
translate([xlen + radius , radius , radius]) sphere(r=radius);
translate([radius , ylen + radius , radius]) sphere(r=radius);    
translate([xlen + radius , ylen + radius , radius]) sphere(r=radius);
translate([radius , radius , zlen + radius]) sphere(r=radius);
translate([xlen + radius , radius , zlen + radius]) sphere(r=radius);
translate([radius,ylen + radius,zlen + radius]) sphere(r=radius);
translate([xlen + radius,ylen + radius,zlen + radius]) sphere(r=radius);
       }
}
radiusedblock(30,40,50,5);
3

To round a cylinder, you should use something like HULL command for two spheres.

It will make a tube where each sphere is the cap of the tube, by wrapping them into a new object.

You can use that to round your cylinder with minkowski.

minkowski between the cylinder and the rounded tube. If you merge a sphere with a cube, it will also round the long tube zone and make it pregnant. Hull is very useful, you can do 100ds of hull commands instead of an extrusion for complex stuff for example.

Also check Fibonaci sphere from thingiverse for an interesting sphere, although it isn't symmetrical as is best on a tube.

1

I needed the same thing today, and the answers here were only semi-useful, so I implemented my own module. Feel free to use/share :)

module roundedcube(xx, yy, height, radius) {

difference(){

    cube([xx,yy,height]);

    difference(){
        translate([-.5,-.5,-.2])
        cube([radius+.5,radius+.5,height+.5]);

        translate([radius,radius,height/2])
        cylinder(height,radius,radius,true);
    }
    translate([xx,0,0])
    rotate(90)
    difference(){
        translate([-.5,-.5,-.2])
        cube([radius+.5,radius+.5,height+.5]);

        translate([radius,radius,height/2])
        cylinder(height,radius,radius,true);
    }

    translate([xx,yy,0])
    rotate(180)
    difference(){
        translate([-.5,-.5,-.2])
        cube([radius+.5,radius+.5,height+.5]);

        translate([radius,radius,height/2])
        cylinder(height,radius,radius,true);
    }

    translate([0,yy,0])
    rotate(270)
    difference(){
        translate([-.5,-.5,-.2])
        cube([radius+.5,radius+.5,height+.5]);

        translate([radius,radius,height/2])
        cylinder(height,radius,radius,true);
    }
}
}
Cutetare
  • 874
  • 7
  • 22
  • 2
    I created a gist with a simpler module to achieve the same result. Check out https://gist.github.com/tinkerology/ae257c5340a33ee2f149ff3ae97d9826 – Scott Leslie Feb 17 '20 at 05:57