/// <summary> /// Run this sample /// </summary> public void Run() { try { //iterate through the selection picking out family instances that have a 3D analytical model ICollection <ElementId> selElements = m_doc.Selection.GetElementIds(); if (0 == selElements.Count) { MessageBox.Show("Please selected some in-place family instance with AnalyticalMode.", "InplaceFamilyAnalyticalModel3D"); return; } foreach (Autodesk.Revit.DB.ElementId elementid in selElements) { FamilyInstance familyInstance = m_doc.Document.GetElement(elementid) as FamilyInstance; if (null == familyInstance) { MessageBox.Show("This macro depends on Revit Structure to function properly. Please open this document in Revit Structure to run this macro.", "InplaceFamilyAnaliticalModel3D"); continue; } AnalyticalModel analyticalModel = familyInstance.GetAnalyticalModel(); if (null == analyticalModel) { MessageBox.Show("This macro depends on Revit Structure to function properly. Please open this document in Revit Structure to run this macro.", "InplaceFamilyAnaliticalModel3D"); continue; } AnalyticalModel analyticalModel3D = analyticalModel as AnalyticalModel; if (null == analyticalModel3D) { MessageBox.Show("we should select analytical model 3D family instance, but this familyInstance.AnalyticalModel type is " + analyticalModel.GetType().Name, "InplaceFamilyAnaliticalModel3D"); continue; } //Output the family instance information and the curves of the analytical model. DumpFamilyInstance(familyInstance); DumpAnalyticalModel3D(analyticalModel3D); MessageBox.Show(m_message, "InplaceFamilyAnaliticalModel3D"); } } catch (Exception ee) { MessageBox.Show(ee.ToString()); } return; }