binary-1071776_960_720

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)
				.OfCategory(BuiltInCategory.OST_Views);

			using (Transaction t = new Transaction(doc, "Set Underlay None"))
			{
				t.Start();

				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 );
                                	underlyParam.Set(id);
                                }

                        }

				t.Commit();
			}

		}
 

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

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

Que especie eres? *