I have been try to get the parameter value of family
public class Trial : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
ElementCategoryFilter Family = new ElementCategoryFilter(BuiltInCategory.OST_StructuralFoundation);
FilteredElementCollector collector = new FilteredElementCollector(doc);
IList<Element> Familylist = collector.WherePasses(Family).ToElements();
String prompt = "The Precast Element in the current document are:\n";
foreach (Element e in Familylist)
{
Parameter p = e.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM);
string levelshow = string.Format("Base Level", p.AsValueString());
prompt += levelshow + "\n";
}
TaskDialog.Show("Revit",prompt);
return Result.Succeeded;
}
}
when i run this add-ins in revit, it doesn't work。 But i cant spot any problem