Introduction: Branching Fractal Shapes

Picture of Branching Fractal Shapes

A python maya script that lets you play with branching shapes. A base-object is copied many times, and the copies have a certain relationship to their "parents" so that when one of the first generation-copies is translated, rotated or scaled, all of the children change accordingly. The picture above shows this more clearly.

Motivation: CNC machines like 3D printers and laser cutters are neat because they can create complex geometry, over a range of length scales, that might be tedious for a human to make by hand. One type of shape that takes advantage of these traits are fractals. Fractal geometries are shapes that are self-similar, or look similar on a range of length scales. Interestingly, fractal geometry can be an excellent first-order model of many structures in nature, for example a rough surface, a fuzzy tree canopy, or the hierarchical organization of animal lungs (this is just from casual observation). Some of these structures, like the lung for example, may be organized in such a way that reduces the resistance to flow, while still providing access to a huge number of "things" (check out Constructional Law for more). While this is an abstract picture of a lung, it seems similar to engineering problems like heat-transfer, the distribution of information, or heating ventilation and air-conditioning (HVAC) systems. If tools like 3d printers make fractal-like geometry easier to produce, maybe our machines can take on some of the characteristics of natural structures. But also mostly, fractals!!!!

Trajectory: The script lets one play with geometric branching shapes. While these shapes are constrained to be sort of "regular" and geometric (all the angles are the same, etc.) they may be good first-order solutions to flow/access problems. More complex solutions like this one might work even better!

Fabrication:Ember Printer and epilog laser cutters at pier9 !!

Step 1: Setup: Make an Array of Cubes in Maya

Picture of Setup: Make an Array of Cubes in Maya

Method 1: Download Template File

Download Maya File baseCube_level6.mb attached to this step. Thats it!

Method 2: Play With Script

This is a more involved way to make branching shapes, but allows one to change number of levels, number of branches at a node, base shape, etc.

1. Get the Maya Python Script: Download the script (It is better to get the script from github as I will likely be making changes over time). Notice how awesomely simple it is to set up this kind of fractal array with Maya Python (go to technical documentation at the link)!

2. Load Script: Open the maya script editor (Window -> General Editors -> Script Editor). Make a new tab and set the source type to "Python." Click File -> Load Script and select the downloaded

3. Run Script: Press Ctrl-Enter or click the small blue arrow or at the top of the Script Editor to execute the script. This script creates a function called makeArray(). To run it type makeArray() in the Python Command Line at the lower left corner of Maya. Be patient, about 2^7=128 cubes just got created. Check this out in the Outliner (Window -> Outliner). To change the number of levels type makeArray(nLevels = n) where "n" is the number of levels you want the tree to go to. Be careful inputing large numbers (greater than 10) as Maya will have to deal with alot of cubes, and will likely get slow. This is especially problematic for final steps where all the cubes are combined into one big mesh.

Step 2: Play Around With Placement

Picture of Play Around With Placement

In the Outliner (Windows -> Outliner) select either pCube1 or pCube2, the two children of the parent node. Try moving them, scaling them (0.5 is a good scale factor to start with) and rotating them.

The two children of the root, pCube1 and pCube2, control all subsequent branches. Many shapes are possible. One could also make some pretty neat animations.

To edit the transform (position, rotation and scale) numerically, i.e. rotate a cube by 45 degrees about the x-axis, show the Attribute Editor (Windows -> Attribute Editor) while the cube to be transformed is selected. Then you can enter numbers for things like translation along the y axis, rotation about z, etc.

Maya Basics:

Ctrl + spaceBar => toggle full-screen (hides extra buttons and toolbars)

zoom => scroll wheel

pan => command + Middle-Mouse-Button (mac) or alt + MMB (pc)

orbit => command + let-mouse-buttona

a => view all

f => view selected

h => toggle visibility of selected object

q => select mode

w => translate tool

e => rotate tool

r => scale tool

Step 3: Change Base-Shape Geometry

Picture of Change Base-Shape Geometry

To make a real paper or 3d printed model the cubes, or base-shapes, need to be connected.

1. Enter Vertex Mode: To do this go into vertex mode by right-clicking and dragging on the first cube, and select Vertex from the menu that appears.

2. Snap a Vertex to Another: Select a vertex of the first cube, hit "w" to use the translate tool. Now hold "v", which enables point snapping, or click the small magnet icon with the blue dot at the top of the Maya Window. With this option enabled, as you drag the vertex it will "snap" to the nearest vertex.

3. Connect the Shapes: Do this for all the vertices. To make more vertices available for snapping, use the multi-cut tool in the Modeling Toolkit or look in the drop-down menu at the top called Mesh Tools. Make sure to delete faces that would be inside the shape.

Step 4: One Big Mesh Approach -> 3D Print

Picture of One Big Mesh Approach -> 3D Print

1. Combine Copies: Select root node (pCube1) and then click Mesh -> Combine. This will take a while depending on the number of copies in the tree

2. Merge: Click Edit Mesh -> Merge and set a small threshold (like .001) so that duplicate vertices are merged.

3. Fill Holes: Mesh -> Fill Hole

4. Export STL: File -> Export Selection, choose stl format.

5. 3D print: I used Ember Printer:

Step 5: Individual Units Approach -> Paper Craft

Picture of Individual Units Approach -> Paper Craft

The current set of unfolders out there are not really suited for the complex scaling geometries made here. It is better to unfold the base-shape, and then make the correct number of copies in the vector-drawing program of your choice.

1. Triangulate: Paper cannot make saddle rectangles very well. So any face that is sufficiently twisted must be broken up into triangles, which are always planar*. Use Mesh -> Triangulate command to do his automatically, or use multi-cut tool to do manually.

2. Export Base-Shape: Thats all one needs, the base-shape contains all the information about how branching will occur. Export as stl.

3. Unfold: Unfold. See for more info.

4. Layout in Vector Drawing program: Make scaled copies of the base shape, in this case there are two different scale factors, and for each new copy it should be copied twice and each copies scaled respectively

5. Cut and Fold and Glue

*In the sort of geometrical spaces Maya is built in/on/around.


samtull (author)2016-09-16

Ok, this seems like a really helpful design, and I would love to use it, but I only have Fusion 360 and not Maya. If there is a way you could possibly make the 3d file available for download, that would be super helpful!

jRamonGalindo (author)2015-05-23


Porda (author)2015-05-19

This is great!

That's an interesting point you made about heat transfer. Any plans on making a heat sink or heat exchanger with one of your fractals?

jlopezbi (author)Porda2015-05-20

yeah definetly! maybe for a LED or something

About This Instructable




More by jlopezbi:Pier 9 Guide: How to Register Omax Waterjet Jobs to the Same Origin Why Printing Blocks on Ember is difficultEmber Resin Tray Lid
Add instructable to: