With COM API, "InwOpState.ZoomInCurViewOnCurSel" zooms in on current View on Current selection. You may have found a method in .NET.
Application.ActiveDocument.ActiveView.FocusOnCurrentSelection"
But it only helps set the view to be centered around the selected item and does not zoom into it.
Currently there isn’t any direct .NET API yet to help achieve this zoom in on selection.But you can always use COM interop in .NET. The following code snippet is based on any .NET plugin. It supposes an object is selected. Please copy the code to the plugin, and add the references: Autodesk.Navisworks.ComApi and Autodesk.Navisworks.Interop.ComApi.
using ComApi = Autodesk.Navisworks.Api.Interop.ComApi;
using ComApiBridge = Autodesk.Navisworks.Api.ComApi;
public void zoom()
{
ComApi.InwOpState10 comState = ComApiBridge.ComApiBridge.State;
//Create a collection
ModelItemCollection modelItemCollectionIn =
new ModelItemCollection(
Autodesk.Navisworks.Api.Application.ActiveDocument
.CurrentSelection.SelectedItems);
ComApi.InwOpSelection comSelectionOut =
ComApiBridge.ComApiBridge.ToInwOpSelection(modelItemCollectionIn);
// zoom in to the specified selection
comState.ZoomInCurViewOnSel(comSelectionOut);
// zoom in to the current selection
//comState.ZoomInCurViewOnCurSel();
}
