I wrote a recursion algorithm in the Python/NX Open API to generate these Menger Cubes. No sketching or extrusions, just code.
The approach is similar to OpenSCAD and generative design programming languages like Processing http://www.openscad.org/gallery.html
I will post the code later.
Menger Cube level 3Menger Cube Level 2Menger Cube Level 1
Note to future self:
Before running a dialog box file (.dlx)/python file,
1. Add the following environment variable in Control panel\System
UGII_CUSTOM_DIRECTORY_FILE=<NX install directory>\ugii\menus\custom_dirs.dat
2. Add the following lines (or where ever you intend to place your application) to your custom_dirs.dat
3. Create a new folder called application. Place the dialog box file (.dlx) in the application folder.