Friday, October 19, 2012

Dynamo - Indexed Family Instances

Once classic way to create forms in Revit is to place multiple family instances that are driven by an indexed instance parameter. Zach Kron gives a good explanation in his post Parametric Patterns VI: Increment. The only tedium is in placing and indexing all the instances.

I wondered how hard it would be to place and index the instances using Dynamo, and this is the result:

Indexed Family Instances

The Family Type Selector and the Instance Parameter Selector allow you to choose the family type to place and the driving parameter. The Build Sequence node and its inputs generate the sequence of values for the driving parameter.

The Map node calls my user node ‘Family Instance Creator – Indexed’ once for each number in the sequence, and each time, the node creates a family instance and sets the driving parameter:

Family Instance Creator - Indexed

This is fairly straightforward. All the instances are placed at 0,0,0. The Family Instance Creator node creates the instance, and the Set Instance Parameter node sets the driving parameter.

And here is the result, using a simple twisting box family:

Twisting Tower

Finally, here is the source: Indexed Family Instances.

4 comments:

Clay Starr said...

I've been trying to get your script to work, but it seems to crash every time I run it. I am new to creating new nodes, but when I look into the XYZ.Zero node, there aren't and values in for 'count' or 'space. Could that be causing the problem?

Revitator said...

Hi Clay, thanks for trying out the script, and thanks again for commenting: I'm just sorry it's not working for you.

I'm not sure what you mean by 'there aren't any values for 'count' or 'space''? The XYZ.Zero node is just supposed to return a Revit XYZ element with X, Y and Z set to zero. Maybe I haven't understood.

Just to check some fundamentals, are you running this in Revit or Vasari? So far, I've only tested it in Revit: I will get a copy of Vasari and test it there too.

You've opened the 'Twisting Tower 2.rfa' file, and the main layout has the Type Selector set to Twisting Box and the Parameter selector set to Index?

In more detail, how does it crash? Do you get an alert box, or any text in the text area? Does it crash differently if you run it with debug checked?

Apologies for all the questions, but the answers might help us to work out how to get the script to run for you.

Zach Kron said...

Fantastic little script. I was also having trouble getting it to run until I replaced the Family Parameter Selector with a simple String node that I manually entered the name of the parameter. Now it is awesome and I'm soooo happy

Revitator said...

That's great, Zach. I'm glad it's working for you. You're right: The Family Parameter Selector seems to make it a bit finicky.

I just opened it here and it ran fine; when I changed the family type, the parameter selector didn't update, and that caused a crash. It seems as though if you run it a few times, it eventually gets its ideas sorted out. I'm not sure if there's a way to get the parameter selector to update 'properly', but your String node is a good solution.