Hand machined mechanical pencils

Lorenz attractor drawing with Rhinoscript (01/06/16)

I had previously written a Python script to calculate the Lorenz attractor in realtime and output it to the AxiDraw. While playing around with it, I wanted to try using my big laser cutter to engrave the attractor, so I adapted the Python script to Rhinoscript.

I use Rhinoceros 3D for most design/CAD stuff, and it comes with a built-in scripting language called Rhinoscript. This is based on VBScript and is very powerful - any drawing commands that would normally be performed by the user can be automated. I have previously used it for doing basic animation and also for making procedural textures.

Download the script file here. You can specify which sort of drawing to create - a full 3D curve, or a projection of one of the three planes (the projection is made on to Rhino's XY construction plane). A good value for the maximum steps (stepCnt) is 5000 for a curve - if you're drawing individual points, make this less (e.g. 200), because point drawing is slower. The script first populates an array with the calculated points and, optionally, draws each point as it's calculated - this is good for seeing the attractor evolve. It then draws an interpolated curve through all the points, with the drawPlane option controlling what sort of curve is drawn - 3D or a projection.

Here's a screencap video of the script in action, showing the various modes of operation. Watch it fullscreen since the text is rather small!

Once the curve is drawn in Rhino, it can then be used just like any other path - e.g. for milling, laser cutting etc. Here's an example of the XZ projection engraved into a piece of MDF on a CO2 laser cutter:

And a video of it in action: