openscad

object around the path in OpenSCAD


I want to create a 3D object in OpenSCAD, which is a projection of 3D object "travelling" around the 2D shape. E.g. I have this 2D object:

  hull() {
    circle(r=3);
    translate([0,35,0]) circle(r=3);
    translate([10,0,0]) circle(r=3);
    translate([10,35,0]) circle(r=3);
    }

And I want to have a sphere travelling around its outline. When I use minkowski() transformation, I get not only the path of the sphere filled, but whole area inside the path.

I want this https://en.wikibooks.org/wiki/File:Openscad_rotext_03.jpg as a result, but along the hull object.


Solution

  • So, something like this? Tubular frame outlining a 2D curve To get a hollow output from minkowski(), you have to supply a hollow input, rather than a complete rounded rectange. Ideally this would be a 1-dimensional space curve, but since OpenSCAD doesn't support anything like that, we can approximate it by subtracting two slightly different-sized versions of the rectangle.

    $fa=0.5; $fs=0.5;
    
    module shape(r) {
        linear_extrude(0.01)
            hull() {
                circle(r=r);
                translate([0,35,0]) circle(r=r);
                translate([10,0,0]) circle(r=r);
                translate([10,35,0]) circle(r=r);
            }
    }
    
    minkowski() {
        difference() {
            shape(3);
            shape(2.99);
        }
        sphere(2);
    }