Apply random material to a shared family in a family

Hello guys,

We would like to randomly set a material to a shared family in a family.
Revit seems not to like our aproach and say that the parameter is read only.
We have a brick in a window family that randomly need to change the material.
This brick family is shared, the material is an instance parameter and is loaded into a window family.
We access the family through dynamo and asign these instances with random materials but the parameter is read only.

On the other hand if we drop the brick into the project environment the graph works.

This is something to do with the fact that this family is nested on another family.

Any idea how to work this out???

Many thanks

1 Like

The only workaround is to use directshape but it is not very neat approach

1 Like

You would have to assign the brick material parameter to another material parameter in the parent family.

I need to assign the random material parameter in the child (nested family in the window)

As you’ve said, that parameter is read-only even from the nested family. You would have to tie the nested family’s Material parameter to another Material parameter in the parent family. Then you’d be able to set the parent family’s parameter which would in turn set the nested family’s parameter.

The true is that directshape is much lighter and faster I expexted.
I have 21700 bricks/elements and dynamo run the script in less than 10 minutes.
Image attached with part of the geometry.c6