Message 1 of 4

Not applicable
05-29-2019
06:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey guys,
I'm trying to get the Starting View of a Revit file that I have just opened in the background by doing this:
Document currentDoc = app.OpenDocumentFile(ModelPath, OpeningOptions); // Get opening view Autodesk.Revit.DB.View openingView = currentDoc.ActiveView; // Get opening view's name string openingViewName = openingView.ViewName;
But everytime I get a NullReferenceException because the openingView object is null, which means that I cannot get the .ActiveView property of my currentDoc.
Is it because the currentDoc is opened in the background and not Active?
Is there a way to get the active view of a doc open in the background?
Or really, is there a way to get the Starting View of a document?
I searched the APIs everywhere but couldn't find anything.
Thanks!
Andrea
Solved! Go to Solution.