On a theatre model I need to randomize the seat family instances with its types so that they don’t look all the same. There are four types (each one with a different person on the seat). Initially the instances can be equally divided a quarter of each type and then shuffled in dynamo.
Using Vikram Subbaiah’s ‘All Elements of Family Name’ and ‘Manage.RandomizeOrder’ I was able to randomize the list of seats but could not apply the list result back to Revit.
FamilyInstance.SetType expects a single family type and doesn’t seem to help.
Any ideas?
Thanks for your help erfajo This is quite a sophisticated definition!
It feels like the FamilyInstance.SetType node is where my problem is.
The familyInstance input is finding all instances of the family - if the input in familyType is a type picked using ‘Family Types’ it replaces all instances with this type. However I’m not being able to define the random familyType from the randomized list (probably because the indices change but the association with the element ID remain the same?).
Thanks for your solution Jacob, I reached a passable definition late on Friday which was doing the trick using Element.SetParameterByName, also without working with the correct number of seats and then cropping the list to the amount desired. It felt like it wouldn’t do a good job for hundreds of seats, worked fine for the test with 16 though. See below:
Seeing your post late this morning I decided to give it a go and came to a more refined solution, not sure if it is exactly following your steps but it works. Thanks!
1 Like
When I need to create a random list of specified objects I usually go with one of two methods. The first is similar to what @jacob.small mentioned, and the second creates a random list of indices that I use to select my specified objects.
Here’s an example of the second method.
4 Likes
I like the mathematical approach Nick, this gives more control on the list randomness and also informs how many instances of each type will occur. Will keep it on my records, thank you.