How to turn off Viewport Titles?

Hey,

So I want to auto turn off viewport labels…

I’m really struggling to get hold of the built in parameter values, I’m trying a few different nodes, but they just aren’t giving values… I can see that they exist, but no values!

Would anyone be able to help me understand why?

Thanks,

Mark

Viewport Title.dyn (24.4 KB)

test1.rvt (1.3 MB)

Viewport labels? I am not sure I know what that is, but I will make a guess that you are asking about turning off the Viewport Titles:

If that’s indeed the case, then the easiest way would be to make a Viewport Type that hides the title. For example:

image

Once you have that ready, you would want to change the Viewport Type for the selected Viewports like this:

image

Python code:

# Copyright(c) 2019, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference("RevitNodes")

import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

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

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

def ProcessList(_func, _list):
    return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )

def ProcessListArg(_func, _list, _arg):
    return map( lambda x: ProcessListArg(_func, x, _arg) if type(x)==list else _func(x, _arg), _list )

def Unwrap(item):
	return UnwrapElement(item)

def ChangeViewportType(vp, newVp):
	vp.ChangeTypeId(newVp.Id)
	return vp

if isinstance(IN[0], list):
	viewports = ProcessList(Unwrap, IN[0])
else:
	viewports = [Unwrap(IN[0])]

vpName = IN[1]

try:
	errorReport = None
	allVp = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Viewports).ToElements()
	validTypeIds = allVp[0].GetValidTypes()
	validTypes = []
	for i in validTypeIds:
		validTypes.append(doc.GetElement(i))
	selectedVp = next((x for x in validTypes if x.ToDSType(True).Name == vpName), None)
	TransactionManager.Instance.EnsureInTransaction(doc)
	output = ProcessListArg(ChangeViewportType, viewports, selectedVp)
	TransactionManager.Instance.TransactionTaskDone()
except:
	import traceback
	errorReport = traceback.format_exc()

if errorReport == None:
	OUT = output
else:
	OUT = errorReport

Hope this helps.

Cheers!

4 Likes

@Konrad_K_Sobon you are the man.

Thank you for your time and expertise.

Cheers,

Mark

Hello, I am trying to switch off viewports title in legend. Somehow it does not want to work. It only switches titles of sheet views but not for legends??? :frowning_face:
Thanks a lot

Is the Sheets.Viewports node giving you the legends?

No, but I have found an intermediate solution. When sheets are still empty and only legends are placed, it works perfectly.
Thanks