Message 1 of 4

Not applicable
10-23-2017
01:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm a software engineer at Architecture Design Firm in Dubai. I'm developing revit add-ins for their production team. I would like to know is this possible to extract revit family properties (Type and Isntance) before loading it into the Revit 2017.exe. I did some research and wrote the following code. However, on debugging doc.IsFamilyDocument returns false.
public static void FamilyTransaction(Document doc, string FamilyPath, out Family family) { // Load family from file: using (Transaction tx = new Transaction(doc)) { tx.Start("Load Family"); doc.LoadFamily(FamilyPath, out family); if (doc.IsFamilyDocument) { FamilyManager familyManager = doc.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); } tx.Commit(); }
I'm new into the Revit API, maybe I'm doing it wrong way. Would appreciate any help. Thank you.
Solved! Go to Solution.