proc makeAntenna(string $parentSphereName, float $parentRadius, float $rotAngle, float $scale, int $firstSphere) { if ($firstSphere) { // If the first time called... sphere -name $parentSphereName; // make a sphere scale $parentRadius $parentRadius $parentRadius; // with this radius } select -r $parentSphereName; // Select the parent sphere // Duplicate it, but remember the child's name // duplicate returns an array of strings, only the first of which is useful string $duplicateName[] = `duplicate`; string $childSphereName = $duplicateName[0]; // So remember the first one select -cl; // Clear out the selection select $childSphereName $parentSphereName; // Select the child, then the parent parent; // Make a child/parent relationship select $childSphereName; // Then select the child again float $childSize = $scale * $parentRadius; // How small should the child be? scale $scale $scale $scale; // Scale the child down move -localSpace (1 + $scale) 0 0; // Move the child in local coords select $parentSphereName; // Select the parent again rotate 0 0 $rotAngle; // Rotate around Z, because we're moving in X select -cl; // Safe to unselect again if ($childSize > 0.05) { // If not too small makeAntenna($childSphereName, $childSize, $rotAngle, $scale, 0); // recurse } } makeAntenna("fs", 1, 20, 0.75, 1);