Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change ActiveView

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
7378 Views, 3 Replies

Change ActiveView

Does anyone know how to change the ActiveView?

Thanks,
Bernie

3 REPLIES 3
Message 2 of 4
jeremytammik
in reply to: Anonymous

Dear Bernie,

 

This can be solved by RTFM...

 

Looking at the Revit API help file RevitAPI.chm, there are two separate ActiveView properties listed, on the (DB) Document and the UIDocument classes.

 

The former has only a getter. The latter offers a setter as well:

 

UIDocumen.ActiveView Property 

 

The currently active view of the currently active document.

 

This property is applicable to the currently active document only. Returns null if this document doesn't represent the active document. The active view can only be changed when:

 

 

  • There is no open transaction.
  • IsModifiable is false.
  • IsReadOnly is false.
  • ViewActivating, ViewActivated, and any pre-action of events (such as DocumentSaving or DocumentClosingevents) are not being handled.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4
arnostlobel
in reply to: jeremytammik

Just a side note: I do not recommend using the Document.ActiveView getter - it is an obsolete property that will likely go away at some point in the future. Please always use the ActiveView property on the UIDocument class like Jeremy suggests.

Arnošt Löbel
Message 4 of 4

@arnostlobelIs there any further information on the obsolescence of Document.ActiveView? We have 2021, the property is still part of the API and not marked as deprecated. There is not much API documentation about Document.ActiveView and UIDocument.ActiveView though. Are there any differences?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community