revit-API:How to get the "Offset" in the "View Range" in the "Plan Region"?

680 views Asked by At

my idea

  1. I tried to use "SetViewRange" to get "View Range" in "Plan Region", but "Plan Region" is not "View Plane", only "ViewPlane" can use "SetViewRange" method, so this idea failed.

  2. There is a parameter named "View Range" in the "Parameter" of the "Plane Region", and the "offset value" I want is not found in the parameter "View Range",so this idea failed.

enter image description here enter image description here enter image description here

2

There are 2 answers

0
Callum On

You need to use the GetViewRange method of your plan View, in conjuctnion with the PlanViewPlane object: https://www.revitapidocs.com/2019/80d20187-97ea-f6c0-a3a8-d5545e0b3863.htm

So to get the Offsets looks something like this:

view = uidoc.ActiveView # the plan youre wanting to investigate

topOffset = view.GetViewRange().GetOffset(PlanViewPlane.TopClipPlane) # Top Offset    
cutOffset = view.GetViewRange().GetOffset(PlanViewPlane.CutPlane) # Cut plane Offset    
bottomOffset = view.GetViewRange().GetOffset(PlanViewPlane.BottomClipPlane) # Bottom Offset
0
Brucehans On

the above view needs to be cast as ViewPlan:

ViewPlan view = uidoc.ActiveView as ViewPlan;