Website: http://au.autodesk.com/speaker-resource-center/call-for-proposals/voting
To find my classes use the following (or search by name):
public void ExportWarnings() { try { using (StreamWriter writer = new StreamWriter(@"C:\temp\warnings.txt")) { FailureDefinitionRegistry failures = Autodesk.Revit.ApplicationServices.Application.GetFailureDefinitionRegistry(); IList<FailureDefinitionAccessor> failuresList = failures.ListAllFailureDefinitions(); foreach (FailureDefinitionAccessor failure in failuresList) { if (failure.GetSeverity() == FailureSeverity.Warning) writer.WriteLine(failure.GetDescriptionText()); } writer.Close(); } } catch { } }
public void UpdateLeaders()
{
UIDocument uidoc = this.ActiveUIDocument;
Document doc = uidoc.Document;
// create a collection of all the Arrowhead types
ElementId id = new ElementId(BuiltInParameter.ALL_MODEL_FAMILY_NAME);
ParameterValueProvider provider = new ParameterValueProvider(id);
FilterStringRuleEvaluator evaluator = new FilterStringEquals();
FilterRule rule = new FilterStringRule(provider, evaluator, "Arrowhead", false);
ElementParameterFilter filter = new ElementParameterFilter(rule);
FilteredElementCollector collector2 = new FilteredElementCollector(doc).OfClass(typeof(ElementType)).WherePasses(filter);
ElementId arrowheadId = null;
// loop through the collection of Arrowhead types and get the Id of a specific one
foreach(ElementId eid in collector2.ToElementIds())
{
if(doc.GetElement(eid).Name == "Arrow Filled 30 Degree") //change the name to the arrowhead type you want to use
{
arrowheadId = eid;
}
}
// create a collection of all families
List<Family> families = new List<Family>(new FilteredElementCollector(doc).OfClass(typeof(Family)).Cast<Family>());
using(Transaction t = new Transaction(doc, "Update Leaders"))
{
t.Start();
// loop through all families and get their types
foreach(Family f in families)
{
FamilySymbolSet symbols = f.Symbols;
List<FamilySymbol> symbols2 = new List<FamilySymbol>(symbols.Cast<FamilySymbol>());
// loop through the family types and try switching the parameter Leader Arrowhead to the one chosen above
// if the type doesn't have this parameter it will skip to the next family type
foreach(FamilySymbol fs in symbols2)
{
try
{
fs.get_Parameter(BuiltInParameter.LEADER_ARROWHEAD).Set(arrowheadId);
}
catch
{
}
}
}
t.Commit();
}
}