ProjectPoint returns null after manipulation of view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm developing plugin which jumped to Point3D then select object at the point. However ProjectPoint returns Null after manipulation of view. How can I avoid this issue?
Dim oDoc As Document = Autodesk.Navisworks.Api.Application.ActiveDocument
Dim oCurrVCopy As Viewpoint = oDoc.CurrentViewpoint.CreateCopy
If oDoc.ActiveView.IsInteractive Then oDoc.ActiveView.EndInteractive()
[After modifying oCurrVCopy]
oDoc.CurrentViewpoint.CopyFrom(oCurrVCopy)
Dim oView As Autodesk.Navisworks.Api.View = oDoc.ActiveView
Dim pr As ProjectionResult = oView.ProjectPoint(oPoint, True, True)
If Not pr Is Nothing Then
Dim iResult As PickItemResult = oView.PickItemFromPoint(pr.X, pr.Y, 2, False)
If Not iResult.ModelItem Is Nothing Then
Dim oItem As ModelItem = iResult.ModelItem
oDoc.CurrentSelection.Clear()
oDoc.CurrentSelection.Add(oItem)
Else
oDoc.CurrentSelection.Clear()
End If
End If