Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm attempting to change all "Swing Angle" parameter for all the doors in the project. I'm getting the following error in the foreach loop. No elements are being deleted as the error describes.
An exception of type 'Autodesk.Revit.Exceptions.InvalidOperationException' occurred in RevitAPI.dll but was not handled in user code
Additional information: The iterator cannot proceed due to changes made to the Element table in Revit's database (typically, This can be the result of an Element deletion).
Here is the code.
Thanks.
FilteredElementCollector coll = new FilteredElementCollector(doc) .OfCategory(BuiltInCategory.OST_Doors) .OfClass(typeof(FamilyInstance)); // Filtered element collector is iterable foreach (Element e in coll) { // Get the parameter name Parameter parameter = e.LookupParameter("Swing Angle"); using (Transaction t = new Transaction(doc, "parameters")) // Modify document within a transaction using (Transaction tx = new Transaction(doc)) { tx.Start("Transaction Name"); try { parameter.Set(0.785398163); } catch { } tx.Commit(); } }
Solved! Go to Solution.