Friends I found solution,
In Stand alone application where Navisworks api viewer control
Use below code to view model and zoom in current selection
I used usercontrol for viewer.
private ViewControl viewControl;
public partial class UcViewer : UserControl
{
private ViewControl viewControl;
private DocumentControl documentControl;
public UcViewer()
{
InitializeComponent();
this.viewControl = new ViewControl();
this.documentControl = new DocumentControl();
this.viewControl.Dock = DockStyle.Fill;
this.viewControl.DocumentControl = this.documentControl;
this.viewControl.Location = new Point(0, 24);
this.viewControl.Name = "viewControl";
this.viewControl.Size = new Size(745, 496);
this.viewControl.TabIndex = 1;
this.viewControl.Text = "viewControl";
this.Controls.Add(this.viewControl);
documentControl.SetAsMainDocument();
}
//If the user has selected a valid location, then tell DocumentControl to open the file
//As DocumentCtrl is linked to ViewControl //
public void LoadDocument(string StrFileName)
{
try
{
documentControl.Document.TryOpenFile(StrFileName);
}
catch (Exception)
{
throw;
}
}
}
//miModelItemColloection = Selected item [User can send one or multiple item]
public static void ZoomModelItem(ModelItemCollection miModelItemColloection)
{
try
{
// highlight the items
Application.ActiveDocument.CurrentSelection.CopyFrom(miModelItemColloection);
/*******************/
//None mandatory code
//Just set view point
Document doc = Application.ActiveDocument;
Viewpoint viewPointCopy = doc.CurrentViewpoint.CreateCopy();
// point at adjusts the camera angle, you could also manually adjust this angle
viewPointCopy.PointAt(miModelItemColloection.BoundingBox().Center);
doc.CurrentViewpoint.CopyFrom(viewPointCopy);
/*******************/
ComApi.InwOpState10 state = ComApiBridge.ComApiBridge.State;
ComApi.InwOpSelection selection = ComApiBridge.ComApiBridge.ToInwOpSelection(miModelItemColloection);
// Com API is used to zoom in on the model items, will only zoom does not adjust camera angle
state.ZoomInCurViewOnSel(selection);
}
catch (Exception)
{
throw;
}
}