# Archive for February 23rd, 2016

### Improved Lip Balm / Lipstick Holder

Mary asked for a less angular version of the Lip Balm Holder, which gave me a chance to practice my list comprehension:

Improved Lipstick and Balm Holder

You hand the OpenSCAD program a list of desired tube diameters in the order you want them, the program plunks the first one (ideally, the largest diameter) in the middle, arranges the others around it counterclockwise from left to right, then slips a lilypad under each tube.

As long as you don’t ask for anything egregiously stupid, the results look reasonably good:

Improved Lipstick and Balm Holder – 8 tubes

As before, each tube length is 1.5 times its diameter; the lipsticks / balms fit loosely and don’t flop around.

Given the tube diameters and the wall thickness, list comprehensions simplify creating lists of the radii from the center tube to each surrounding tube, the center-to-center distances between each of the outer tubes, and the angles between successive tubes:

```// per-tube info, first element forced to 0 to make entries match RawDia vector indexes

CtrToCtr = [0, for (i=[1:NumTubes-2]) (TubeRad[i] + TubeRad[i+1] + Wall)];		// Tube[i] distance to Tube[i+1]
echo(str("CtrToCtr: ",CtrToCtr));

echo(str("Angle: ",Angle));

TotalAngle = sumv(Angle,len(Angle)-1);
echo(str("TotalAngle: ",TotalAngle));
```

The angles come from the oblique triangle solution when you know all three sides (abc) and want the angle (C) between a and b:

`C = arccos( (a2 + b2 - c2) / (2ab) )`

Peering down inside, the Slic3r preview shows the lily pads are the tops of squashed spheres:

Improved Lipstick and Balm Holder – Slic3r preview

The pads are 2.0 times the tube diameter, which seemed most pleasing to the eye. They top out at 2.0 mm thick, which might make the edges too thin for comfort.

Update: Here’s what it looks like with a convex hull wrapped around all the lilypads:

Improved Lipstick and Balm Holder – hulled base

I’m awaiting reports from My Spies concerning the typical diameter(s) of lipstick tubes, then I’ll run off a prototype and see about the lily pad edges.

The OpenSCAD source code as a GitHub gist: