Hello Dynamo Community!
Getting and setting View Range parameters did work very well in many plans but now i found some viewrange settings that give me errors.
In the first case i think that the nodes can´t handle an “unlimited” setting because it is giving me nulls.
In the second case i don`t even see the Problem. The view range is valid because i got it from another view.
In most cases it´s working just fine.
So can you please give me some help so that i can improve this to handle all kinds of view range settings?
Here is the Python Code for setting the view range
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
v = UnwrapElement(IN[0])
tof = IN[1]
bof = IN[2]
cof = IN[3]
dof = IN[4]
count = 0
TransactionManager.Instance.EnsureInTransaction(doc)
#getting the viewrange of the view
viewrange = v.GetViewRange()
asslvl = v.GenLevel
#Setting top clip plane of the viewrange
# Setting level of topclip plane
viewrange.SetLevelId(PlanViewPlane.TopClipPlane,asslvl.Id)
# setting offset of top clip plane
viewrange.SetOffset(PlanViewPlane.TopClipPlane,tof)
#Setting bottom clip plane of the viewrange
# Setting level of bottom clip plane
viewrange.SetLevelId(PlanViewPlane.BottomClipPlane,asslvl.Id)
# setting offset of bottom clip plane
viewrange.SetOffset(PlanViewPlane.BottomClipPlane,bof)
# setting offset of cut plane
viewrange.SetOffset(PlanViewPlane.CutPlane,cof)
#Setting view depth plane of the viewrange
# Setting level of view depth plane
viewrange.SetLevelId(PlanViewPlane.ViewDepthPlane,asslvl.Id)
viewrange.SetOffset(PlanViewPlane.ViewDepthPlane,dof)
#Applying the viewrange to the view
v.SetViewRange(viewrange)
count = count +1
TransactionManager.Instance.TransactionTaskDone()
OUT = '%d view ranges altered' %(count), v
Thank you very much in advance!