Random Rotation and Height

After seeing the FamilyInstance.SetRotation node in Dynamo, I wanted to figure out how to randomly rotate elements. There are typically not many elements that you would want to rotate randomly, but it can be done to plantings to make them appear more naturalistic in renderings.

And if you are assigning a random rotation to your plantings, then it would also be useful to randomize their height (within a specified range).

The rotation aspect of this definition is the easy part, especially if you use Clockwork’s Random Integer node.dynamo_def

The random parameter takes a bit more work, but is still fairly simple. I deconstructed the code from Math.RandomIntegerList so that you can specify a minimum in addition to the maximum.

To set this up, I had to create 2 type parameters (min and max) and an instance parameter that was driving the actual height of the planting. The input only requires those 3 parameter names and the selected elements.

So you can take a selection of any (or all) plantings that look like this…

trees_01

And randomly rotate and size them to look like this…

trees_02

If you don’t quite like the results, you can run it again. (Just as a reminder, be sure to run in Manual mode.)

trees_03

This method can be used to randomly rotate and size any loadable component.

And for those who might be interested, I think I will be creating my own Dynamo package with custom landscape related nodes… so stay tuned for details next week.

trees_03_real

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s