smile-jie
smile-jie

Reputation: 11

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

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

Upvotes: 1

Views: 873

Answers (2)

Brucehans
Brucehans

Reputation: 1

the above view needs to be cast as ViewPlan:

ViewPlan view = uidoc.ActiveView as ViewPlan;

Upvotes: 0

Callum
Callum

Reputation: 588

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

Upvotes: 0

Related Questions