Thursday, February 13, 2014

Randomize Color and Material in Revit

Over the past few years I have been using curtain wall system for many different things beside storefront and curtain wall, and yet there is an easy way to mimic a design with a random pattern. Since the introduction with reporting parameters, I was able to build in some of the intelligence in the curtain panel. I have come across an plug-in called Randomizer from dp Stuff for some time and really didn't have the opportunity to investigate more in depth until recently. I thought I would take a stab and see how this plug-in can do for me.

According to the description from the site:
"The way it (the Randomizer) works – it lets you locate the instance parameter that you want to randomize among the family instances in your document by selecting the Category, then Family and then Type of your objects." In other words, it will generate a numerical value in the instance parameter for you without doing this manually.

What I am trying to do is to use the plug-in to randomize the color (hint: material) in the curtain panel to create random/mosaic pattern. Since we are talking about a material, not a number, it probably won't work with the plug-in!? I, however, have another challenge to overcome. In the component family environment, Revit won't allow you to formulate the material parameter. All you can do is to set the material as a parameter; in the formula field, you won't be able to input formula like you can for other type of parameter (e.g. Length). I recall a trick from Alfredo Medina that you can parametrize a material with conditional statement using nested family. So, I ended up rigging up a curtain panel family with a setup that looks like this:

Here's the run down of the setup. I have a nested family with 4 types (each type assigned different colors) inside the curtain panel. In the curtain panel family, set up the nested family with a Generic Model type as instance parameter.

I set up an integer parameter called "Driver" (instance parameter). Use the "Driver" parameter as part of conditional statement. The integer is associated with a specific Generic Model type parameter (color):

1 = Green
2 = Yellow
3 = Red
4 = Blue

Now, I have an numerical value (integer) that the randomizer plug-in would recognize in order to run a random integer (material) in the project.

I start off running this plug-in on a curtain wall with grid divided by 60"x60". Select the "Driver" instance parameter; from the value range, I set my minimum value to 1 and my maximum value to 4, which it will randomly choose the color among the 4 types that I assign. Click the Randomize button and let the plug-in do the rest. A nice feature of the Randomizer is I could keep hitting the button and the plug-in will continue to run.

Next, I double up the grid number with the size of 30"x30".

I also have a parameter "Thickness", throw in to the mix with the Randomizer and it gets more interesting...
Note: I set the material with transparency of 20% as the panels appear to be somewhat opaque.

One thing that I wish for this plug-in to work better is to be able to randomize two sets of instance parameters simultaneously. As of now, I have to run the instance parameter one after another one, it will do just fine.

Double up the grid again to 15"x15" at last, this time Revit takes much longer to generate the results.

This has been a great experiment for me to explore this Randomizer to a different use in design without using the more advanced plug-in like Dynamo. On the other hand, I am sure there are other ways to do this using other plug-in.
Next week I will attend the tex-fab workshop up in Austin, Texas to learn more about Dynamo, we will see what I'll be able to get out from this event.

If you are interested in reverse engineer this curtain panel family, you can download it from the link below:

Randomized Panel rfa