Macro to Set Underlay level to none

The way Revit sets the Underlay level of a new Floor Plan view is not of great help for those who work with a high amount of views. Configuring view by view the Underlay parameter to none is a repetitive task that brings no additional value and it consumes too much time.Unfortunately, Revit does not ease up the things, and a batch modify option of the viesws doesn’t exist for the “out of the box” Revit.  So the only way that I found to fix my issue was recurring to the Macros.

I share this code snippet and hope that it will be useful for you guys:

		public void SetUnderlayViewNone()
			UIDocument uidoc = this.ActiveUIDocument;
			Document doc = this.ActiveUIDocument.Document;

			FilteredElementCollector filteredviews = new FilteredElementCollector(doc)

			using (Transaction t = new Transaction(doc, "Set Underlay None"))

				foreach (Element e in filteredviews)
                                View myviewplan = e as View;
                                string viewName = myviewplan.Name;

                                Parameter underlyParam = myviewplan.get_Parameter(BuiltInParameter.VIEW_UNDERLAY_ID);
                                if (underlyParam != null) {
                                	ElementId id = new ElementId( -1 );




This code affects the entire model so be careful with what you are doing.