Advertisements

Swept Claw Model

Our Larval Engineer asked for help with an OpenSCAD model of a 3D printable claw that, she says, has nothing at all to do with the upcoming Night of Little Horrors. Not having had an excuse to fiddle with the new (and lightly documented) sweep() functions, I gnawed on the sweep-drop.scad example until this popped out:

Swept Claw - solid model

Swept Claw – solid model

That might be too aggressively sloped up near the top, but it’s a start.

The OpenSCAD source code:

use <sweep.scad>
use <scad-utils/transformations.scad>

function shape() = [[0,-25],[0,25],[100,0]];

function path(t) = [100*(1+sin(-90-t*90)), 0, (100 * t)];

step = 0.01;

path_transforms = [for (t=[0:step:1-step]) 
    translation(path(t)) * 
    scaling([0.5*(1-t) + 0.1,0.75*(1-t) + 0.1,1])];
    
sweep(shape(), path_transforms);

It’s perfectly manifold and slices just as you’d expect; you could affix it to a mounting bracket easily enough.

Some notes on what’s going on…

The t index determines all the other values as a function of the layer from the base at t=0 to the top at t=0.99.

The shape() defines the overall triangular blade cross-section at the base; change the points / size to make it look like you want.

The path() defines the XYZ translation of each slab that’s extruded from the shape() cross-section. I think the Z value sets the offset & thickness of each slab. The constant 100 in the X value interacts with the overall size of the shape(). The 90 values inside the sin() function set the phase & scale t so the claw bends the right way; that took some fiddling.

The parameters in scaling() determine how the shape() shrinks along the path() as a function of the t parameter. The 0.1 Finagle Constants prevent the claw from tapering to a non-printable point at the tip. I think the Z value must be 1.000 to avoid weird non-manifold issues: the slabs must remain whatever thickness the sweep functions set them to be.

It compiles & renders almost instantly: much faster than I expected from the demos.

The folks who can (and do!) figure that kind of model (and the libraries behind it) from first principles have my undying admiration!

Advertisements