How to set the cropbox view visibility

Hi everyrone,

Do you think setting cropbox views is a pain ?

You’re using the Python Node only ? Me too!

So here`s a script that will set the cropbox view visibility for floorplanviews and ceilingplanviews in your project.

You can adapt this script for other viewtypes :beers:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import FilteredElementCollector, View, ViewType

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

doc = DocumentManager.Instance.CurrentDBDocument

views = FilteredElementCollector(doc).OfClass(View).ToElements()

TransactionManager.Instance.EnsureInTransaction(doc)

for view in views:
	if view.IsTemplate != True:
		if view.ViewType == ViewType.CeilingPlan or view.ViewType == ViewType.FloorPlan:
			view.CropBoxVisible = False

TransactionManager.Instance.TransactionTaskDone()

OUT = views
2 Likes