Anelok: the 2015 case 1/2: background

Werner Almesberger werner at
Mon Jan 19 16:14:12 UTC 2015

So far, I made the case design with fped, by making a 2D drawing for
each layer and use some scripts to stitching the layers together
into a 2.5D model. This worked, but there are a lot of things in
such a construction process that fped isn't really designed to be
good at, and those things were therefore quite hard to do.

As an example, there are many cut-outs, either for things that need
to pass a wall (e.g., the USB receptacle) or for things that just
need space (e.g., the battery). With a proper CAD, one would make a
simple geometric model for the cut-out (e.g., a box for USB) and
then subtract it from the rest.

With fped, I had to draw the inside of the wall to the cut-out, then
a line to the outside, and then back. Then repeat it all for the
opposite side. This doesn't sound too bad, but it also means that I
couldn't use the handy macro that drew rectangles with rounded
corners, or had to "generalize" it.

So the end result was something increasingly cryptic:

The model was also woefully incomplete and I didn't look forward to
tackling the trickier bits, such as the lanyard hole and some
internal cut-outs I found to be necessary.

So I decided to give FreeCAD a try. After all, it says it's nice and
parametric, just what I need. It also has a nice sketcher that lets
you "declaratively" define geometries in no time. So far, so good.

Then came the moment when I wanted to adjust some parameter, e.g.,
the diameter of the cylinder containing the lanyard hole. It let me
do that without complaining, but then all the things that depended
on that geometry were out of sync.

To make a long story short, I don't think this mechanism is useful
for non-trivial designs. There are plans to improve this, but that's
not there yet and may take a good while.

However, there is a plan B: FreeCAD can also be scripted in Python.
The workflow would now be more similar to what I had done with fped
(edit, compile, inspect, edit, ...), but I'd still have that 3D
engine of a real CAD to do things like those pesky cut-outs for me.

This approach worked and I have the script to prove it:

It's longer than the fped script but it also does more. E.g., there
are more case details and it also generates some components, for
easier orientation.

This is what the model for the complete case currently looks like:

What I haven't figured out yet is how to make nice automatic
measurements, like I have in fped. I could calculate points and then
place a measurement on them, but there would be no guarantee that
the calculation matches the actual geometry. Or I could pick edges
or surfaces and do measurements between them, but the process of
selecting those edges and surfaces looks a bit grueling to me.

I then had to find a way to generate toolpaths from the FreeCAD
model. FreeCAD has no toolpath generation yet (they're working on
it). Some people suggest PyCAM, but that doesn't seem to have the
ability to make the sort of precise cuts we need here. Some use
HeeksCAD, which has nice CAM support that may actually be able to do
what we need, but the workflow would be rather complicated and

So I wrote a slicer for 2.5D models that then produces horizontal
polygons I can feed to the tools I already used before. This is the

Driving my old tools with the new data also revealed a great number
of bugs. They're fixed now, so overall quality of my virtual toolbox
should have improved after this ordeal :)

Next: results from a first try.

- Werner

More information about the discussion mailing list