Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to create a plugin primarily for modifying the names of elements in the current project file(contains walls, slabs, and family instances, etc)
The code is as follows
Document doc = m_revit.ActiveUIDocument.Document;
FilteredElementCollector collector = new FilteredElementCollector(doc);
collector.WhereElementIsNotElementType();
Transaction ts = new Transaction(doc, "update");
ts.Start();
int num=0;
foreach (Element elem in collector)
{
num++;
if (elem != null)
{
string newname=elem.Name+num.ToString();
elem.Name = newname;
}
}
ts.Commit();
But it reports an error:
This element does not support assignment of a user-specified name.
Please help me.
Solved! Go to Solution.