Extracting Family Name and Type from Object.

Extracting Family Name and Type from Object.

Anonymous
Not applicable
15,800 Views
2 Replies
Message 1 of 3

Extracting Family Name and Type from Object.

Anonymous
Not applicable

I have beat myself silly trying to figure this out..  I wish to show Family Name, Type and Coordinates of a Family Instance. I can get The Type, but am unable to figure out how to get the Family that the Type belongs to..  Here is my code:

 

IEnumerator e = collection.GetEnumerator();

bool MoreValue = e.MoveNext();

while (MoreValue)

{

Element component = e.Current as Element;

LocationPoint obJCoord;

obJCoord = (LocationPoint)component.Location;

ElementId id = component.GetTypeId();

ElementType et = doc.get_Element(id) as ElementType;

TaskDialog.Show("ObjectIformation", "ElementType - " + et.Name.ToString() + "\n"+

"Coordinates - " + obJCoord.Point.ToString()) ;

MoreValue = e.MoveNext();

}

 

What do I need to do?

Accepted solutions (1)
15,801 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

 

I inserted some code that should move you along to wherever you are going. Good luck!

 

IEnumerator e = collection.GetEnumerator();

bool MoreValue = e.MoveNext();

while (MoreValue)

{

Element component = e.Current as Element;

FamilyInstance fInstance = e as FamilyInstance;

FamilySymbol FType = fInstance.Symbol;

Family Fam = FType.Family; 

LocationPoint obJCoord;

obJCoord = (LocationPoint)component.Location;

ElementId id = component.GetTypeId();

ElementType et = doc.get_Element(idas ElementType;

TaskDialog.Show("ObjectIformation""ElementType - " + et.Name.ToString() + "\n"+

"Coordinates - " + obJCoord.Point.ToString()) ;

MoreValue = e.MoveNext();

Message 3 of 3

Anonymous
Not applicable

Thank you..  So simple.

0 Likes