The issue of Revit View Underlay setting has been bothering me for a really long time (well, not “really long time” but since I started using Revit for production), and in this post I will describe the issue and propose a solution with Revit Python Shell script. I have read around on various Revit forums and blogs and found a few other people complaining about this too, although I actually expected to see many more people bringing that up. So, the problem is when you batch – create a bunch of plan views for a series of level unless it is the “lowest” level in the document each of these views will come in with its View Underlay property set to have a level below as an underlay. Yes, that is the default behavior, the question is who in the world would ever want to set an underlay for the majority of their plan views? Maybe every now and then, but it is mostly an exception rather than something that would deserve a default setting. I was hoping that I could actually change somewhere the default setting for the overlay setting, maybe Revit.ini file or some other place, but no – I couldn’t find it anywhere (if you know that it is possible PLEASE COMMENT!). It cannot even be controlled from View Template, so apparently it is set in stone. It really gets annoying when you just created 30-50 plan views and you have to go into each one of them and set View Underlay to None.
Luckily we have Revit Python shell and as at often happens one can fix a lot of things and stay much more effective / productive with just a few lines of code. Below you will find a Python script that will allow you to select a bunch of views from the Browser and set their View Underlay setting to None. Not a perfect solution (I wish we were allowed to control that from Revit.ini) but definitely better than clicking each view and changing it one by one. Remember – repetitive tasks destroy your brain cells – don’t settle for assembly-line tasks!
- Download the batchSetUnderlayToNone.txt script from here (assuming you have Revit Python Shell installed)
- Undock the Project Browser and select (Shift-Select) any views that you want to set Underlay to None (undocking the Project Browser will allow you to keep those view in the selection when you change to an active view to run Python Shell)
- Switch to any active view and fire up the Revit Python Shell (make sure the Selection Filter shows these earlier selected views in the active selection)
- Open the earlier downloaded batchSetUnderlayToNone.txt and run it…(that will set Underlay setting of all the selected views to None)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import clr import math clr.AddReference('RevitAPI') clr.AddReference('RevitAPIUI') from Autodesk.Revit.DB import * app = __revit__.Application doc = __revit__.ActiveUIDocument.Document uidoc = __revit__.ActiveUIDocument selection = uidoc.Selection selEls = selection.Elements t = Transaction(doc, 'Batch Set Underlay to None') t.Start() for el in selEls: if (el.Category.Id.IntegerValue == int(BuiltInCategory.OST_Views)) and (el.CanBePrinted): p = el.get_Parameter(BuiltInParameter.VIEW_UNDERLAY_ID) if (p is not None): p.Set(ElementId.InvalidElementId) t.Commit()