3D ontwerp SCAD – Parametric Cable Chain

As I did not find a cable chain suiting my needs, I decided to make my own.

I was looking for a fully parametric cable chain, capable of output in CSG.
The Cable Chains I found here were mostly only .stl Surfaces.

Also I wanted to be able to build not only a single Chainlink, but a complete cable chain.
Here you can specify a vector consisting of the angles towards the previous chain links.

In future the will be an additional option to differing link types, to restrict angular movement of the chain.

The Cable Chain is generated though a nested vector.
There is a tupel consisting of the chain link type (at the moment there are only type 1: restricted to 45° movement and type 2: +-45° movement, type 3 generates a nice looking closed but mechanically not necessarily reasonable closed chain, type 4 onwards is just the same as type 3) and the angle of this link towards the previous. e.g. [1,30] is a link with a 30° angle.

The chain links are not optimized for printing. I made this to be able to quickly add cable chains in a solid geometry format into my FreeCAD Printer Assembly. If you want to print customized chain links, you can of course just set the chain length to a single element and export the .stl:
ChainDef = [[1,0]];
I will add a link type optimized for printing. But maybe it could be of interest for you how to generate parametric chains, as OpenSCAD is a functional language you cannot use “for” loops and variables, for evaluating the input vector, it has to be made in a recursive function.

Please, don’t mind the bad formatting of the source with German words in the comments, I just quickly made this in one afternoon, as I needed it as a quick and dirty solution for my 3D printer project, but I thought, maybe it could be of interest to somebody here, so I put it here anyway in this “beta” version.

I will surely update it with a better structured and commented version sometime later.