by emmett, published
As much as I love OpenSCAD, constructive solid geometry is just not efficient at certain tasks and I got tired of waiting for hundreds of spheres to be unioned and rendered to make a knot. This is a parametric Matlab script to do the same thing as MakeALot's script, but in seconds instead of hours, plus the mesh is smoother.
The [3,1] knot I printed required more material for support than the print did, but it came out nice in the end. I designed it to fit a 12.7mm steel ball I had extras of from a Geomag set. Since the knot is toroidal, the ball freely rolls around the inside without falling out.
I included a couple of other example knot STLs in case you can't run the script.
Run VarKnot.m in Matlab (or Octave, which hopefully should also work) and adjust the commented parameters at the beginning of the file as desired. It uses surf2stl.m, which I included because I made some adjustments from the version available on the Matlab file exchange. There don't appear to be any license conflicts, and hopefully my changes will show up there soon too. Basically I added the ability to export multiple objects in a single STL, which is what you get with the [2,4] knot, for instance.
There is a vertical stretch parameter that allows the knot to be taller (to make supportless printing possible) while maintaining the circular cross-section. There is also a thickness parameter that flattens the bottom of the STL to make a base area where the print can actually stick to the build platform.
The one lame thing about scripting this versus the OpenSCAD version, is there's no guarantee your mesh will be manifold. Basically you have to look at the plot and adjust the parameters so that it doesn't self-intersect.