Hello,
I'm trying to get family types available in the document. It looks, that I've found a simple example how to deal with family types here:
public void GetFamilyTypesInFamily(Document familyDoc) { if (familyDoc.IsFamilyDocument) { FamilyManager familyManager = familyDoc.FamilyManager; // get types in family string types = "Family Types: "; FamilyTypeSet familyTypes = familyManager.Types; FamilyTypeSetIterator familyTypesItor = familyTypes.ForwardIterator(); familyTypesItor.Reset(); while (familyTypesItor.MoveNext()) { FamilyType familyType = familyTypesItor.Current as FamilyType; types += "\n" + familyType.Name; } TaskDialog.Show("Revit",types); } }
However, after I run this function I get this :
Though I'm quite new to Revit and it's API, as I understand I have at least 2 family types (pp1 and pp2), so why I do not get them?
Solved! Go to Solution.
Solved by MarryTookMyCoffe. Go to Solution.
The code you show is designed to work within the family definition in an RFA file.
The project browser snapshot you show is in a project, an RVT file.
That requires a different approach.
Here is one way to go to export a family usage report in a project to XML:
http://thebuildingcoder.typepad.com/blog/2010/12/xml-family-usage-report.html
Cheers,
Jeremy
Thanks a lot for your reply Jeremy,
However I cannot fully agree with you here. It's a RFA file I am working in. Also there is a condition in third line: "if (familyDoc.IsFamilyDocument) " and TaskDialog only shows under this condition, thus this lets me to believe that its an RFA file type.
Oh dear. I think you are absolutely right, and I was completely wrong. Sorry about that.
My next suggestion would be to have a look at your RFA file database contents using RevitLookup.
Have you done that yet?
Hi,
In general family types of an element are stored in different places (depending on which categories) in the project browser in a project document (rvt).
In a family document (rfa), that's different organized.
You will find family types in the modify tab (properties panel; with the four blue cubes icon) in a family document.
So your screenshot saying about 'family' type pp1 and pp2, those are not your family types.
Your are referring to something like 'profile' types, do you? That is something different.
By the way, there is nothing wrong with your sample code.
Test it on a different family document, then you will get the family types.
Good luck!
so-chong
Hi Yonas,
Hmm..interesting how Dynamo place these profiles in 'Family Types'.
Family Types must have a different meaning in Dynamo then in Revit.
I have no experience with Dynamo at all.
Could you provide a family document (rfa) where these profiles exist?
As an attachment in your message.
First i suggest to get a Revit lookup, this way you can see what class and what parameters have object you selected, it make life easier.
Going back to your problem, it look like you what to find FamilySymbol(that's how family types class is called in Project document).
I can only speculate but it look like you create new types in project, but then open a family in Api from path(new made types in project are not saved to family) and search for it. Remember that if you didn't name your type in family editor it will be named by family name, but from api it will be empty string.
@MarryTookMyCoffeand @jeremytammik,
thanks a lot for your advice about Revit look up. @MarryTookMyCoffe, you were right. It's familysymbol type. Now I am able to get these types.
Can't find what you're looking for? Ask the community or share your knowledge.