[c#]代码库
try
{
TextElement text = null;
// filtrate the TextElment from the element set
ElementClassFilter gridFilter = new ElementClassFilter(typeof(TextElement));
FilteredElementCollector collector = new FilteredElementCollector(m_doc);
collector.WherePasses(gridFilter);
IList<Element> arrayText = collector.ToElements();
// matching and capitalizing
int capitalizednum = 0;
foreach (Element ee in arrayText)
{
text = ee as TextElement;
text.Text = text.Text.ToUpper();
capitalizednum++;
}
// Show the number of notes modified.
MessageBox.Show("Revit has completed its search and has made " + capitalizednum + " modifications.","CapitalizeText");
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}