Plan Region - Get/Set View Range

Hi

I am trying to create lots of plan regions for local view ranges in a project.
This is really inefficient to do manually, so I was thinking I could do it in Dynamo.

My issue right now is that I am unable to retrieve the builtin parameter PLAN_REGION_VIEW_RANGE.
null is returned. RevitLookUp returned “null” for this parameter as well.

Does anyone know if there is a solution to set plan region view ranges?

What I have so far: (Element in image below is a Plan Region element)
image

Code:

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

# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

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

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

def tolist(obj):
	if isinstance(obj, list):
		return UnwrapElement(obj)
	else:
		return [UnwrapElement(obj)]

elements = tolist(IN[0])
viewranges = []
OUT = []

for elem in elements:
	viewranges.append(elem.get_Parameter(BuiltInParameter.PLAN_REGION_VIEW_RANGE))

if len(viewranges) > 1:
	OUT = viewranges
else:
	OUT = viewranges[0]

It doesn’t look like the API provides any facility for this. The ViewPlan class has the SetViewRange() method, but it wont work on plan view regions.

:sob:

Hopefully this will be implemented in the near future.
I don’t know if it is already possible, but I could not find a way to create Plan Regions through the Revit API either.
These 2 things could be very useful tools.

Anyways, thank you for your clarifying response as always, @Thomas_Mahon :slight_smile:

Any updates on this?

I have not looked into this in a long time, but a quick search in the Revit API docs shows me that in 2022, there was added a property for ParameterTypeIds called PlanRegionViewRange.
[PlanRegionViewRange Property]
This is a read only property that tells us something about a parametertype on an element.
This probably means that we can collect the Plan Region as an element and find the parameter that has this ParameterTypeId.
I don’t know how to change the property from that point, as I cannot try it out at the moment.
Probably not much though, but only one way to find out :slight_smile:

1 Like

Has anybody tried @andre.abotnes suggestion? or should we move dynamo objects to zero after grouping them and selecting a base point?