Public Overrides Function RunCommand(ByVal context As IRhinoCommandContext) _
As IRhinoCommand.result
Dim gp As New MRhinoGetPoint()
gp.SetCommandPrompt("Select view to adjust")
gp.Get2dPoint()
If (gp.CommandResult() <> IRhinoCommand.result.success) Then
Return gp.CommandResult()
End If
Dim view As MRhinoView = gp.View()
gp.SetCommandPrompt("Camera Location")
gp.GetPoint()
If (gp.CommandResult() <> IRhinoCommand.result.success) Then
Return gp.CommandResult()
End If
Dim location As On3dPoint = gp.Point()
gp.SetCommandPrompt("Look At Location")
gp.GetPoint()
If (gp.CommandResult() <> IRhinoCommand.result.success) Then
Return gp.CommandResult()
End If
gp.DrawLineFromPoint(location, False)
Dim lookat As On3dPoint = gp.Point()
Dim gs As New MRhinoGetString()
gs.SetCommandPrompt("Name")
gs.SetDefaultString(view.ActiveViewport.Name())
gs.GetString()
If (gs.CommandResult() <> IRhinoCommand.result.success) Then
Return gs.CommandResult()
End If
Dim vp As New OnViewport(view.ActiveViewport().VP())
vp.SetCameraUp(OnUtil.On_zaxis)
vp.SetCameraLocation(location)
vp.SetCameraDirection(lookat - location)
view.ActiveViewport().PushViewProjection()
view.ActiveViewport().SetVP(vp, True)
view.ActiveViewport().SetName(gs.String())
context.m_doc.Properties().AddNamedView(view.ActiveViewport().View())
view.Redraw()
Return IRhinoCommand.result.success
End Function