Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to access the elements of the Nested family?

Anonymous

How to access the elements of the Nested family?

Anonymous
Not applicable

I met a nested family object built in the Revit structure, which consists of several lamps.

I want to change the illumination and color of these lamps by the Revit API, how can I do it?

0 Likes
Reply
Accepted solutions (1)
1,530 Views
5 Replies
Replies (5)

jeremytammik
Autodesk
Autodesk

Call EditFamily to open the family definition as a separate document.

 

Modify the family definition, and then reload it.

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.23.3

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

RPTHOMAS108
Mentor
Mentor
Accepted solution

There are two types of nested family i.e. shared and non-shared:

 

A shared nested family exists in it's own right in the project document even though it is nested into another family. I believe also this is independent of nesting level.

 

This mainly means:

  1. It can be accessed by the method FamilyInstance.GetSubComponentIds likewise the host family can be accessed the other way via FamilyInstance.SuperComponent
  2. Instance geometry for the nested family is not included in the geometry of the host family 
  3. Type parameters for the nested family can be accessed directly in the project

When a non-shared family is nested it can't be accessed the ways above directly in the project. The instance geometry of the host also contains the geometry of the nested family.

 

If you can tab into the family from the project then it is shared.

 

You may need to edit the family in either circumstance depending on the authored behaviour of the family. Items such as colours (materials) often need to be selected from a predefined list. The obvious choice for a family author would have been to add material parameters to the family and change such things in the project.

Anonymous
Not applicable

Thanks for your very much !

Could please give me some example?

0 Likes

Anonymous
Not applicable

Thank your very much !

Could please give me some example?

0 Likes

Anonymous
Not applicable

I found your another topic about modifying and saving family.
Your mean to modify the family file (.rfa) directly from API ?

0 Likes