I am trying to activate a view using Revit API. What I want to do exactly is to display the level or floor plan view. So the view I want to activate ( I mean, I want this view to be actually shown on screen) already exists, and I can access its Id.
I have seen threads about creating, browsing, filtering views, but nothing on activating it... It's a Floor Plan view. (What I want is that by selecting a level/ floor plan, it displays that level/ floor plan on-screen(it's like opening that floor plan from the already existing Revit model to display on the user screen). And then I want to activate all the walls of that floor plan/ level.
This questions was answered here already How can I activate (display) a view (floor plan or Level) using Revit API?
c#
Here is an example how to switch to the default 3d-view https://thebuildingcoder.typepad.com/blog/2011/09/activate-a-3d-view.html
you can do the same with all other available views like this
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
uidoc.ActiveView = yourview;
or with python
Super easy to do:
# normally you have the ui set at the start of your script
ui = __revit__.ActiveUIDocument
# then just set the ActiveView as your view (not the ViewId)
ui.ActiveView = yourView
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.