PDA

View Full Version : 2014 Conditional statment to assign material dependent on integer??



Thiefsie
2013-09-25, 05:33 AM
Does anyone have the smarts to figure this out?

I want to set up a material that is in a way randomised by an integer parameter... essentially so that an integer can be used to flick between different colours, and perhaps randomise the integer.

Such that, integers are as below:
1 = Red
2 = Blue
3 = Green
4 = Clear

for instance.

I guess it's is an if(integer = 1 then material = red)

Any help would be greatly appreciated!

Thiefsie
2013-09-25, 05:50 AM
I'm trying to do something like this but material parameters can't be used in formulas??

Any ideas?

93571

Thiefsie
2013-09-25, 06:09 AM
I'm guessing I'm going to have to have multiple geometries (with alternate finishes) in the family and then control visibility with a parameter. The problem with this is that I need the integer param (MAT ID) to stay instanced so it can vary throughout the project...
Is there a better way to solve this?

Thiefsie
2013-09-25, 06:42 AM
Ah - obviously I had to instance the yes/no parameters for visibility to work as attached:

This seems to be a decent result.9357293573

Alfredo Medina
2013-09-26, 08:59 AM
Yes, this is possible. There are at least 3 ways:

1) As an adaptive repetition. Meaning, a pattern-based curtain panel that repeats along the nodes of a divided surface, having its material controlled by the location of an adaptive point. You need 2 adaptive families. One is the "repeater", and the other one is the "repetition". In the latter, you need to create 5 family type parameters if you want 4 different combinations of material. Four of these Family Type parameters are simply the definitions of "green panel", "red panel", "blue panel", and "clear panel". The fifth parameter is the one that is driven by a formula, something such as "if 'distance' is not less than 10 and not greater than 20, use material "green panel", if 'distance' is ..., etc...".

2) Using Rhino, and a tool named as Grasshopper, it is possible to define these formulas. Then, using another tool named as Chameleon these formulas can be executed inside Revit to create all these panels on a facade, with different materials.

3) There is a tool, named such as "Randomizer" for Revit, which I have seen in forums. I have not used it, though, but you could search for it and see if it helps you to do this.

greg.mcdowell
2013-09-26, 07:16 PM
Another approach is to use nested families with materials applied by type and use the integer to set the nested family active.

http://wikihelp.autodesk.com/Revit/enu/Community/Tips_and_Tricks/Families%2c_Parameters%2c_Formulas/Formula-Driven_Types