Resetting MEP systems overrides

Revit MEP models allow overriding graphical display of entire MEP systems. It can be problematic when linking such models to eg. architecture. Often we would like to adjust visibility settings of MEP elements, but it cannot be done because of those overrides. Their priority is higher then view templates or filters.

A solution for that is removing those overrides for every system separately, every time we receive a new revision of the MEP model… Fortunately it can be automated by using Dynamo or macros.

Nodes setup is not very complex. The most important part is obviously the last one – containing some python code:

import clr

#The inputs to this node will be stored as a list in the IN variables.
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices


from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

systemType = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)

for st in systemType:
	st.LineColor = Autodesk.Revit.DB.Color.InvalidColorValue
	st.LineWeight = -1
	st.LinePatternId = ElementId.InvalidElementId
	
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = 0

As far as I know Revit API does not contain a function to reset the overrides. However for each category (line weight, line color, pattern) assign a default value and thus remove its override.

Similarly above problem can be solved with a C# macro:

 public void clearMEP() {
			
	Document doc = this.ActiveUIDocument.Document;
	UIDocument uiDoc = new UIDocument(doc);
			
	FilteredElementCollector mepCollector = new FilteredElementCollector(doc).OfClass(typeof(MEPSystemType));
			
	using(Transaction t = new Transaction(doc,"clear MEP overrides")){
					
		t.Start();					
		foreach(Element e in mepCollector) {					
			MEPSystemType mst = e as MEPSystemType;
			if(mst!=null) {
				mst.LineColor = Color.InvalidColorValue;
				mst.LineWeight = -1;
				mst.LinePatternId = ElementId.InvalidElementId;
			}							
		}					
		t.Commit();
	}
}
Posts created 32

Leave a Reply

Your email address will not be published.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top