Turn off Subcategory from Views

Hello,

I am trying to turn off the " Internal Origin" subcategory from all views.
I can turn off this category for a few views. Some views are not turn off this category.

“View.SetCategoryOverrides” node shows the error message as shown in below image.
image

1 Like

Hello

a Python solution for all Views (templates or not)

import clr
import sys
import System
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
sdkNumber = int(app.VersionNumber)
sdkSubVer = app.SubVersionNumber

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
if sdkNumber > 2020 or sdkSubVer == "2020.2":
	collView = FilteredElementCollector(doc).OfClass(View).ToElements()
	bic = BuiltInCategory.OST_IOS_GeoSite
	bicId = ElementId(bic.value__)
	outView = []
	
	TransactionManager.Instance.ForceCloseTransaction()
	TransactionManager.Instance.EnsureInTransaction(doc)
	
	for v in collView:
		if v.CanCategoryBeHidden(bicId):
			v.SetCategoryHidden(bicId, True)
			outView.append(v)
	TransactionManager.Instance.TransactionTaskDone()	
	
	OUT = outView
else:
	OUT = 'Wrong Revit Version'
2 Likes