Introduction:

'Modular Algorithm' is an Autodesk Maya modeling script for exploring pattern making developed by Zachariah Muñoz in Spring 2006. It was originally conceived as an academic project for a seminar on iterative tools, taught by Billie Faircloth at the University of Texas at Austin, School of Architecture. Several patterns generated with the script were used in the design of the building shown to the right.

     Methodology:

A range of architectural criteria determine which values in the script are selected to become variables. Once these values have been determined a block is created and the process repeats itself. The method by which the blocks are assembled is controlled by translation and rotation values that may also become scripted, depending on the desired output. A randomness operator, furthermore, is included in the script in order to generate a variety of solutions to a single design goal.

The following list offers a brief description of selected variables from the script:

$Opacity:
$BlockDepth:
$BlockWidth:
$BlockRotate:
$Random:
$YTrans:
$ZTrans:
$RunSum:

Probability, ranging from 0% to 100%, that determines whether to remove a block.
Depth of block.
Width of block.
Rotation of block in x-axis.
A random number generated between 0 and 10.
Translation of block in the y-axis.
Translation of block in the z-axis.
A sum of translation values in the X-axis that controls pattern iterations.
Each of these variables, except $RunSum and $Random, may be reconfigured as a function or constant number. The following scripts offer examples of how different pattern types may emerge by adjusting the function of any given variable. The $Opacity variable, furthermore, is operable in each illustration in order to show its influence over the pattern generated. Each script may be copied and pasted directly into Maya’s MEL script editor for execution.
     Pattern 01 :
int $i;
     for ($i = 0; $i < 500; $i++)
          {
          int $Opacity = 20;
          float $BlockDepth = 1;
          float $BlockWidth = ceil(rand(0, 8));
          float $Random = ceil(rand(0, 10));
          float $YTrans;
          float $RunSum;
               if ($i == 0)
                    {
                    $YTrans = 0;
                    $RunSum = 0;
                    };
               if ($RunSum >= 50)
                    {
                    $YTrans++;
                    $RunSum = 0;
                    };
          $RunSum = ($BlockWidth / 2) + $RunSum;
          polyCube -w $BlockWidth -d $BlockDepth;
          move -r -ls -wd $RunSum $YTrans 0;
               if ($Random > ((100 - $Opacity) / 10))
                    delete;
          $RunSum = ($BlockWidth / 2) + $RunSum;
          };
select -cl;
     Pattern 02:
int $i;
     for ($i = 0; $i < 500; $i++)
          {
          int $Opacity = 40;
          float $BlockDepth;
          float $BlockWidth = ceil(rand(0,8));
          float $Random = ceil (rand(0,10));
          float $YTrans;
          float $RunSum;
               if ($i == 0)
                    {
                    $YTrans = 0;
                    $RunSum = 0;
                    };
               if ($YTrans == 0)
                    $BlockDepth = 25;
               if ($RunSum >= 50)
                    {
                    $YTrans++;
                    $RunSum = 0;
                    };
          $RunSum = ($BlockWidth / 2) + $RunSum;
          polyCube -w $BlockWidth -d $BlockDepth;
          move -r -ls -wd $RunSum $YTrans 0;
               if ($Random> ((100 - $Opacity) / 10))
                    delete;
          float $BlockDepth = 25 - ($YTrans / 2);
          $RunSum = ($BlockWidth / 2) + $RunSum;
          };
select -cl;
     Pattern 03 :
int $i;
     for ($i = 0; $i < 500; $i++)
          {
          int $Opacity = 60;
          float $BlockDepth = ceil(rand(0,10));
          float $BlockWidth = ceil (rand(0,8));
          float $Random = ceil(rand(0,10));
          float $YTrans;
          float $RunSum;
               if ($i == 0)
                    {
                    $YTrans = 0;
                    $RunSum = 0;
                    };
               if ($RunSum >= 50)
                   {
                   $YTrans++;
                   $RunSum = 0;
                    };
          $RunSum = ($BlockWidth / 2) + $RunSum;
          polyCube -w $BlockWidth -d $BlockDepth;
          move -r -ls -wd $RunSum $YTrans 0;
               if ($Random> ((100 - $Opacity) / 10))
                    delete;
          $RunSum = ($BlockWidth / 2) + $RunSum;
          };
select -cl;
     Pattern 04:
int $i;
     for ($i = 0; $i < 400; $i++)
          {
          int $Opacity = 40;
          float $BlockDepth;
          float $BlockRotate;
          float $BlockWidth = ceil(rand(0,8));
          float $Random = ceil(rand(0,10));
          float $YTrans;
          float $ZTrans;
          float $RunSum;
               if ($i == 0)
                    {
                    $YTrans = 0;
                    $RunSum = 0;
                    };
               if ($YTrans == 0)
                    $BlockDepth = 15;
               if ($RunSum >= 50)
                    {
                    $YTrans++;
                    $RunSum = 0;
                    };
          $RunSum = ($BlockWidth / 2) + $RunSum;
          float $CvStep = $YTrans / 10;
          $BlockDepth = ceil(rand(0,10));
          $BlockRotate = (3 * pow($CvStep, 2) * sin($CvStep))
          + (cos($CvStep) * pow($CvStep, 3));
          $ZTrans = pow($CvStep, 3) * sin($CvStep);
          polyCube -w $BlockWidth -d $BlockDepth;
          move -r -ls -wd $RunSum $YTrans $ZTrans;
          rotate -r -os $BlockRotate 0 0;
               if ($Random > ((100 - $Opacity) / 10))
                    delete;
          $RunSum = ($BlockWidth / 2) + $RunSum;
     };
select -cl;
     Pattern 05:
int $i;
     for ($i = 0; $i < 500; $i++)
          {
          int $Opacity = 50;
          float $BlockWidth = ceil(rand(0,8));
          float $Random = ceil(rand(0,10));
          float $YTrans;
          float $RunSum;
               if ($i == 0)
                    {
                    $YTrans = 0;
                    $RunSum = 0;
                    };
               if ($RunSum >= 50)
                    {
                    $YTrans++;
                    $RunSum = 0;
                    };
          $RunSum = ($BlockWidth / 2) + $RunSum;
          polySphere -r 1 -sx 4 -sy 3 -ax 0 1 0 -tx 1;
          move -r -ls -wd $RunSum $YTrans 0;
          scale -r $BlockWidth 1 1;
               if ($Random > ((100 - $Opacity) / 10))
                    delete;
          $RunSum = ($BlockWidth / 2) + $RunSum;
          };
select -cl;
     Pattern 06:
int $i;
     for ($i = 0; $i < 2000; $i++)
          {
          int $Opacity = 50;
          float $BlockDepth;
          float $BlockRotate;
          float $BlockWidth = ceil(rand(0,1));
          float $Random = ceil(rand(0,10));
          float $YTrans;
          float $ZTrans;
          float $RunSum;
               if ($i == 0)
                    {
                    $YTrans = 0;
                    $RunSum = 0;
                    };
               if ($RunSum >= 50)
                    {
                    $YTrans++;
                    $RunSum = 0;
                    };
          $RunSum = ($BlockWidth / 2) + $RunSum;
          float $CvStep = $YTrans / 10;
          $BlockDepth = 1;
          $BlockRotate = (3 * pow($CvStep, 2) * sin($CvStep))
          + (cos($CvStep) * pow($CvStep, 3));
          $ZTrans = pow($CvStep, 3) * sin($CvStep)
          + pow(($RunSum / 10), 2);
          polySphere -r 1 -sx 4 -sy 3 -ax 0 1 0 -tx 1;
          move -r -ls -wd $RunSum $YTrans $ZTrans;
          rotate -r -os $BlockRotate 0 0;
               if ($Random > ((100 - $Opacity) / 10))
                    delete;
                    $RunSum = ($BlockWidth / 2) + $RunSum;
     };
select -cl;
     Conclusion:
The patterns that have been generated thus far are not critically informed by a system of construction. Many of the blocks in the preceding patterns, for example, remain suspended in space, unsupported by a structural frame. Further work on these scripts would involve the inclusion of a function that generates a type of scaffolding system that supports the blocks. This system would likely be influenced by new variables relating to physical properties such as weight and materials.

Regarding the format of the algorithm itself, the next improvement would involve the development of a graphical user interface that enables users to generate new patterns through a dialog box, without the burden of modifying a text file. This type of interface would be useful not only as a pattern-making instrument, but also as an educational tool for introducing users to a basic understanding of the MEL scripting language.

Site created by Zachariah Muñoz