Reputation: 2888
How can I use the Revit API to get the Starting View for a Document
? The equivalent way to access it using the user interface is seen below:
Upvotes: 1
Views: 839
Reputation: 25
I know this is an older thread, but you can use the StartingViewSettings class like this:
StartingViewSettings.GetStartingViewSettings(doc).ViewId
Upvotes: 1
Reputation: 2888
I used the Revit Lookup tool and browsed through the database to find a class called StartingViewSettings
with the property ViewId
that will get me the ElementId
of the starting view. My actual code for getting the view is below
FilteredElementCollector startingViewSettingsCollector =
new FilteredElementCollector(document);
startingViewSettingsCollector.OfClass(typeof(StartingViewSettings));
View startingView = null;
foreach(StartingViewSettings settings in startingViewSettingsCollector)
{
startingView = (View)document.GetElement(settings.ViewId);
}
Upvotes: 2