Clear Overrides for chosen category in ViewTemplate

Hi!
I am looking for possibility to clear chosen overrides for the chosen category in all ViewTemplates
image

Do you know any nodes / python codes which could be useful in that case?

When i do it manualy i just duplicate view without details.
Than i copy the 2D-Elements fro, one to an other view.

Maybe this?

I mean to clean overrides only for chosen category, chosen column (e.g. clean projection/surface patterns and stay rest as is).
I thought also that it could be achieved by new overrides for selected options by setting empty/null values - but I am not sure if that is possible

Using python nodes I am able to set any overrides - but can I used value as None?

I tried to do this using this method but I got info that it’s only read value.
image

I was able to achieve removing overrides for the chosen category but unfortunately, it removed all overrides for category. Could anyone help me with that problem?

# Load the Python Standard and DesignScript Libraries
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit import DB
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Preparing input from dynamo to revit
category = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])


#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

if view.ViewTemplateId == DB.ElementId.InvalidElementId:
	ovg = DB.OverrideGraphicSettings()
	ovg.SetCutLineColor(DB.Color.InvalidColorValue)
	#ovg.SetProjectionFillColor(DB.Color.InvalidColorValue)
	#ovg.SetSurfaceBackgroundPatternColor(DB.Color.InvalidColorValue)
	#ovg.SetSurfaceForegroundPatternColor(DB.Color.InvalidColorValue)
	view.SetCategoryOverrides(category.Id, ovg)

	
	# send true if successfule
	OUT = True
else:
	# send False if not
	OUT = False

TransactionManager.Instance.TransactionTaskDone()

You’re applying a new (empty) ovg on that category.

Try to get the existing ovg of the category in that view with view.GetCategoryOverrides(category.Id) and apply your changes to it.

1 Like