Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extracting Family Name and Type from Object.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
bbyrum
15038 Views, 2 Replies

Extracting Family Name and Type from Object.

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?

2 REPLIES 2
Message 2 of 3
bketel
in reply to: bbyrum

 

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
bbyrum
in reply to: bketel

Thank you..  So simple.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community