Automatic label nested family to parameter

Dear,

I am working on a family where I would like to provide the nested families with a Label parameter, see attachment.

I have already searched the forum but I do not come across an equal article.

In addition, I tried using an associate parameter script, but it is not an associate parameter, so this option does not work.

https://forum.dynamobim.com/t/associate-family-parameter-in-a-family/19709/4

I have searched in the api but my knowledge is too little to find the right option here.

Can someone help me on my way to find the right method.

thanks in advance

If I understand correctly, the nested families already have a Label parameter, but you would like to assign a value to a family if it is nested. The FamilyInstance class has a GetSubcomponentIds() method, which is probably what you are looking for. This will be slightly more complicated if you have multiple levels of nesting, but it is still feasible. Likewise, each FamilyInstance has a SuperComponent property which will help you determine if you are at the highest point in the family’s hierarchy (i.e. it is not itself a nested component).

thank you for the quick response but what i actually mean:

I have a main family with nested families placed in it.

This nested family always has a build in label parameter (see image circled in red)

You can manually assign this label to a parameter in the main family so that you can exchange the nested family at project level.

Now my question is how can I assign a parameter to the label of the nested family with a python code.