Get room informations from FamilySymbol

Get room informations from FamilySymbol

Anonymous
Not applicable
1,163 Views
6 Replies
Message 1 of 7

Get room informations from FamilySymbol

Anonymous
Not applicable

Hello,

how can i get the room informations from a FamilySymbol? With a FamilyInstance it works, but not with FamilySymbol:

 

Capture.PNG

 

Thanks

 

Daniel

0 Likes
Accepted solutions (1)
1,164 Views
6 Replies
Replies (6)
Message 2 of 7

Sean_Page
Collaborator
Collaborator

It is because a FamilySymbol does not exist in a room. It is the top level element for a Family that holds the Types, but the FamilyInstance is what is placed in the model and therefore can have room information. 

Sean Page, AIA, NCARB, LEED AP
Senionr Partner, Computational Designer, Architect
Message 3 of 7

Anonymous
Not applicable

I have the following problem. In instance object I get all the parameters without values. In the symbol object I only get the parameters assigned to the family with the values but not the room. How do i get the room information and the assigned parameters with values?

 

Untitled1.pngUntitled2.png

0 Likes
Message 4 of 7

Sean_Page
Collaborator
Collaborator

Perhaps I am a bit confused, but I understood that you were trying to get information from the Room, and supply it to your Family inside that room. If that is true, you would be using Instance Based parameters which would not require the Family Symbol. If you are trying to set Type Parameters, then you need to get the Family Type.  

ElementType fType = doc.GetElement(famInst.GetTypeId) as ElementType;

If this is not what you are trying to do, could you please explain a little more on what you expect the result to be?

 

Sean Page, AIA, NCARB, LEED AP
Senionr Partner, Computational Designer, Architect
0 Likes
Message 5 of 7

Anonymous
Not applicable

Thanks, this is the solution what i need. The last point to finish my function is, how can i select only a FamilyInstance, perhaps with a if statement? Like: if (SpecialityEquipmentElementsMain[iEquipment] == "FamilyInstance") ....

 

Untitled.png

0 Likes
Message 6 of 7

Sean_Page
Collaborator
Collaborator
Accepted solution

I think you should be able to use the "is" statement to get this done.

 

Example:

        private Room FamRoom()
        {
            IList<FamilyInstance> fams = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).Cast<FamilyInstance>().ToList();
            if (fams[12] is FamilyInstance famIst)
            {
                Room room = famIst.Room;
                return room;
            }
            return null;
        }
Sean Page, AIA, NCARB, LEED AP
Senionr Partner, Computational Designer, Architect
0 Likes
Message 7 of 7

Anonymous
Not applicable

Thanks a lot!! it works.