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)
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]