Matlab Knot

by emmett, published

Matlab Knot by emmett Mar 17, 2011

Featured Thing!

10 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps



BSD License
Matlab Knot by emmett is licensed under the BSD License license.

Use This Project

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

15560Views 2944Downloads Found in Math Art


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.

More from Math Art

view more

All Apps

3D Print your file with 3D Hubs, the world’s largest online marketplace for 3D printing services.

App Info Launch App

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App

Thank you for sharing your matlab script files. They also ran with octave too!

Jan 5, 2015 - Modified Jan 5, 2015

Just to avoid some confusion, the "[p,q] knot" notation used here indicates either a "(p,q) torus knot", or a "(p,q) torus link", depending on the co-primality of p and q. Thus "[3,1] knot" = "unknot", then "[2,5] knot" = "knot 5_1", and "[2,4] knot" = "link of 2 components with linking nuber 2".

Hello Emmet,

Can I ask you something 8-) , your second image show a base that was created using a script right? Sorry for my question , i don't know if I understood ...
So I like that because I just started printing and I have some Action figure modeled on Zbrush, that I want to print, and they need a struct
ure to be build ..
For this wolverine maybe I could print in pieces but for a small scale for sure needs a structure.

Congratulation for the model! ;)

best regards

Marcelo P

I'm guessing by "base" you mean support structure? Skeinforge has an option for support (there's a checkbox in ReplicatorG for it as well), which is what I used on knot31. Makerbot also has some useful how-to articles about it on their blog.

You mean the structure that you took of the knot31.. ??

I will check .. thanks anyway man!

In case you've never used support before (like me!) then let me warn you that "exterior" support won't cut it!

Do you think it is (or could be) possible in OpenSCAD to define the cross-sectional geometry and then "extrude" it along a mathematical path?

That would be totally amazing. I imagine that's something that wouldn't be too terribly difficult to implement, but then again I'm not a programmer :-P

I'm pretty sure the only hard part would be maintaining manifoldness. Plenty of other CAD programs do it, so there must be algorithms for it; the question is do they exist in CGAL?