hull() – hull modifier Tutorial

hull() is a simple command to use, merely place whatever objects from which you want to form a hull as children of the command. The hull command() merges the outermost bits to form a single object. ( It is really a bit magical to me ).

It is one of those commands that I personal don’t find a lot of use for, but here and there I find ways it can make life easier.

For example:

Two sphere’s and a hull give us this pill shape:

hull(){
    sphere(r=5,$fn=50);
    translate( [20,0,0] ) sphere(r=5,$fn=50);
}

Just for this article I made this Axe Head using hull and a few other commands. Don’t ask why, it just popped into my head. Is is a little more “Low Poly” than I wanted but it was interesting how easily I was able to complete it.

Here is the code I used:

One of the concepts this code highlight s is that hull() works on both 2D Object and 3d Objects

rotate([-90,0,0]){
    hull() {
        linear_extrude(1)
            square([5,20],center=true);
        rotate([30,0,0])
            rotate([0,-90,0])
                rotate_extrude(angle=60,$fn=50)
                    translate([40,0] )
                        circle(.1,$fn=50);
    }

    difference() {
        union() {
            hull(){
                translate([0,0,-20])
                    linear_extrude(1)
                        square([5,20],center=true);
                translate([0,0,-10])
                    linear_extrude(1)
                        square([5,25],center=true);
        }

        hull(){
          translate([0,0,-10])
                linear_extrude(1)
                    square([5,25],center=true);
            linear_extrude(1)
                square([5,20],center=true);
            }
    }

    translate([0,50,-10])
        rotate([90,0,0])
            linear_extrude(){
                hull($fn=50){
                    translate ([0,0]) circle(r=2);
                    translate ([0,3]) circle(r=1.5);
                    translate ([0,-3]) circle(r=1.2);
                }
            }
    }
}

2d vs. 3d Hull

the hull command coan be used in the 2d sub-system or the 3d system

2D Hull

3d Hull

hull to make a simple cam, using cylinder.

Before hull()

After hull()

Simple code for this cam:

CAM_OFFSET=30;

hull(){
    cylinder(h=20,r=30);
    translate([CAM_OFFSET,0,0])
        cylinder(h=20,r=10);
}

Hopefully this gives you some ideas on what to use hull() for, I will keep looking looking for some best use case.

Leave a Reply

Your email address will not be published. Required fields are marked *