Menger Sponge 1.0
Level 4 Menger Sponge
3.2 KB
Release Date
August 4, 2010
SketchUp Version
Compatible with SketchUp 6 or newer
Operating System
Windows or OSX

Download Menger Sponge 1.0

Ruby zipped (.rbz) file



The Menger Sponge is a 3D fractal in the Mathematical world. It is defined recursively, where each level is constructed from components of the previous level. By applying a few simple rules over and over, it is interesting how such a complex structure results.

Actually, you don't need a plugin to do this. You can create any level of the Menger Sponge just using the SketchUp GUI. This plugin was basically an exercise in using the SketchUp Ruby API to build complex components from subcomponents. I left the source code unscrambled, if anyone wants to see how it works.

To construct the first level, start with a cube, scale it down to one third size, make 27 copies, and arrange them in a 3x3x3 grid. Then remove the cube at the middle of each face, and remove the cube in the center, leaving 20 cubes. This is the first level sponge.

To construct the second level, apply the same process to the first level sponge. The result is the second level sponge.

For any level, apply the same process to 20 copies of the previous level sponge. This plugin will construct the Menger Sponge up to the fifth level.

Level 1 Menger Sponge Level 2 Menger Sponge


This plugin is accessed from the Draw menu (Draw > Menger Sponge). This will open a dialog box to enter the parameter values.

The outside color was left undefined, and shows up as white by default. You can easily change the outside color by clicking anywhere on the component with the paint bucket.

You can change the color of the inside faces almost as easily. Open the component by double-clicking on it with the select tool. The faces are grouped by material. So, if you click on any inside face with the paint bucket, all the faces that are the same color will be painted.

When you click OK, the Menger Sponge is created as a component, and the component placement tool is activated to position it in the model.

The dialog box remembers the values between SketchUp sessions.

Menger Sponge Dialog Box