Hi,
I am trying to randomly assign materials to these families in Revit. I have basically 2 circles, one of them is nested. I have assigned the different materials (instance based) to each of them and the family is shared.
When I am assigning the materials I can assign them randomly but unfortunately both forms take the same materials, which is not the indented result.
Any help with nested families and assigning materials to them?
Thanks!
![Screenshot 2024-06-04 124120](https://global.discourse-cdn.com/business6/uploads/dynamobim/original/3X/6/9/69e111ffde1b3d2bfe91b97fffcc2de7ee374f92.png)
You’ve shown us nothing. We have no idea how you’re assigning materials to either family or how the families are setup to manage their material parameters. We need screenshots and information.
Have you confirmed that you can control both families’ material parameters in Revit? If you can’t do it in Revit, you won’t be able to do it in Dynamo. Are the parameters connected? What does your graph look like? Do you have the right lacing or list levels for multiple elements?
Did you assign different material parameters to the main family and the nested family or are they linked?
I’m guessing it is a list lacing/levels issue, or an instance / type parameter issue.
Hi Nick,
I apologize, was in a rush I will now better explain; even though strangely after restarting my Revit somehow it worked.
As you said, the materials in Revit work, so the 2 materials are instance based and if I change them in Revit I can see the result please see attached Pic 1.
The round form is comprised of the inner part which is shared nested family and it has a material assigned to the family itself. I then connected that to the hosted family’s material parameter.
I am selecting all these forms and randomly assigning materials, which initially didn’t work even though I didn’t change anything other than, as I said above, restarted both my Revit and Lumion.
There are some of the forms which have the same material assigned on the edge and the inner part but I am okay with it since it is meant to be random, so it can happen.
Please see below attached snips and I’d appreciate it any critique.
Edit: added snip 6. It is the view I have in Revit.
Thanks for the reply!
Ah nice attempt. My personal preference is adding ratio’s to the colors and using a Seed number instead of overly cycling the list
I’m also curious to see a schedule where you sort on material 1 and material 2 and adding a Count parameter to it. That way you can see the total amount of panels and get the ratio’s that way (you should see 16 configurations)
Another approach if of interest. I like to use a separate list.shuffle for a pseudorandom outcome I can return to if object count remains the same in session. I’ve used the count > multiply > floor method for years now to retrieve the random object. From what I’ve been told and seen at large scale it’s relatively efficient.
random thing getter.dyn (23.9 KB)
Assembling the total count and getting the nth permutation of the list will likely be more efficient if you’re looking for some degree of optimization.
Generative Design At Hogwarts package has a Python version of the node for just that.
However it only works for lists about 20 items deep, so I recommend splitting the list and getting a permutation for each list when you need to exceed that count.
1 Like
Hi,
Thank you for the reply, I added the selection method you had since it was more easy than my original.
I am still using number sliders to cycle and shuffle the list, the division worked but I found it easier to use the slider number even though I might get 2x the necessary list for my elements but I can live with that.
Another thing that I am interested is how does this work with nested families? I initially had the inner circle nested but for some reason I couldn’t set the parameter value by name since I got an error saying that the parameter is read-only. (The error I guessed was for the nested families material parameter).
I created the inner part in the family itself and stopped using nested families so now everything works fine, please see attached a picture.
I assumed the nested family would work just fine but it wasn’t the case, it is definitely an error on my part, that’s why I’d like to know how would one go about using set parameter by name on nested families.
Thanks!
To be honest I’m not even sure why those families need to be nested. But in case you need them for schedules or something you can set the parameter as long as you connect them to a parameter of your host family. Also make sure the nested family material parameter is Instance based
In this case you are right, no need for them to be nested. My question stemmed from the problem I encountered while trying to make it work as nested, and I was just generally curious how that would work.
I appreciate your help!