McNeel Wiki
How To: Add a named view
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

 
.
Developer.NET
SummaryDemonstrates how to define and add a named view

VB.NET (Rhino 4)

  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
rename · changes · history · subscriptions · lost and found · references · file upload