ModelAidSettings.Ortho Property

ModelAidSettingsOrtho Property

Gets or sets the enabled state of Rhino's ortho modeling aid.

Namespace:  Rhino.ApplicationSettings
Assembly:  RhinoCommon (in RhinoCommon.dll)
Syntax
public static bool Ortho { get; set; }
Public Shared Property Ortho As Boolean
	Get
	Set

Property Value

Type: Boolean
Examples
using Rhino;
using Rhino.ApplicationSettings;
using Rhino.Commands;
using Rhino.Input.Custom;

namespace examples_cs
{
  public class OrthoCommand : Command
  {
    public override string EnglishName
    {
      get { return "csOrtho"; }
    }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      var gp = new GetPoint();
      gp.SetCommandPrompt("Start of line");
      gp.Get();
      if (gp.CommandResult() != Result.Success)
        return gp.CommandResult();
      var start_point = gp.Point();

      var original_ortho = ModelAidSettings.Ortho;
      if (!original_ortho)
        ModelAidSettings.Ortho = true;

      gp.SetCommandPrompt("End of line");
      gp.SetBasePoint(start_point, false);
      gp.DrawLineFromPoint(start_point, true);
      gp.Get();
      if (gp.CommandResult() != Result.Success)
        return gp.CommandResult();
      var end_point = gp.Point();

      if (ModelAidSettings.Ortho != original_ortho)
        ModelAidSettings.Ortho = original_ortho;

      doc.Objects.AddLine(start_point, end_point);
      doc.Views.Redraw();
      return Result.Success;
    }
  }
}
Imports Rhino
Imports Rhino.ApplicationSettings
Imports Rhino.Commands
Imports Rhino.Input.Custom

Namespace examples_vb
  Public Class OrthoCommand
    Inherits Command
    Public Overrides ReadOnly Property EnglishName() As String
      Get
        Return "vbOrtho"
      End Get
    End Property

    Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result
      Dim gp = New GetPoint()
      gp.SetCommandPrompt("Start of line")
      gp.[Get]()
      If gp.CommandResult() <> Result.Success Then
        Return gp.CommandResult()
      End If
      Dim start_point = gp.Point()

      Dim original_ortho = ModelAidSettings.Ortho
      If Not original_ortho Then
        ModelAidSettings.Ortho = True
      End If

      gp.SetCommandPrompt("End of line")
      gp.SetBasePoint(start_point, False)
      gp.DrawLineFromPoint(start_point, True)
      gp.[Get]()
      If gp.CommandResult() <> Result.Success Then
        Return gp.CommandResult()
      End If
      Dim end_point = gp.Point()

      If ModelAidSettings.Ortho <> original_ortho Then
        ModelAidSettings.Ortho = original_ortho
      End If

      doc.Objects.AddLine(start_point, end_point)
      doc.Views.Redraw()
      Return Result.Success
    End Function
  End Class
End Namespace
Python
from Rhino import *
from Rhino.ApplicationSettings import *
from Rhino.Commands import *
from Rhino.Input.Custom import *
from scriptcontext import doc

def RunCommand():
  gp = GetPoint()
  gp.SetCommandPrompt("Start of line")
  gp.Get()
  if gp.CommandResult() != Result.Success:
    return gp.CommandResult()
  start_point = gp.Point()

  original_ortho = ModelAidSettings.Ortho
  if not original_ortho:
    ModelAidSettings.Ortho = True

  gp.SetCommandPrompt("End of line")
  gp.SetBasePoint(start_point, False)
  gp.DrawLineFromPoint(start_point, True)
  gp.Get()
  if gp.CommandResult() != Result.Success:
    return gp.CommandResult()
  end_point = gp.Point()

  if ModelAidSettings.Ortho != original_ortho:
    ModelAidSettings.Ortho = original_ortho

  doc.Objects.AddLine(start_point, end_point)
  doc.Views.Redraw()
  return Result.Success

if __name__ == "__main__":
  RunCommand()
Version Information

Rhino for Mac

Supported in: 5.4

Rhino for Windows

Supported in: 6.14
See Also