AnnotationObjectBase.DisplayText Property

AnnotationObjectBaseDisplayText Property

Gets the text that is displayed to users.

Namespace:  Rhino.DocObjects
Assembly:  RhinoCommon (in RhinoCommon.dll)
Syntax
public string DisplayText { get; }
Public ReadOnly Property DisplayText As String
	Get

Property Value

Type: String
Examples
using Rhino;
using Rhino.DocObjects;
using Rhino.Commands;
using Rhino.Input.Custom;

namespace examples_cs
{
  public class ReadDimensionTextCommand : Rhino.Commands.Command
  {
    public override string EnglishName
    {
      get { return "csReadDimensionText"; }
    }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      var go = new GetObject();
      go.SetCommandPrompt("Select annotation");
      go.GeometryFilter = ObjectType.Annotation;
      go.Get();
      if (go.CommandResult() != Result.Success) 
        return Result.Failure;
      var annotation = go.Object(0).Object() as AnnotationObjectBase;
      if (annotation == null)
        return Result.Failure;

      RhinoApp.WriteLine("Annotation text = {0}", annotation.DisplayText);

      return Result.Success;
    }
  }
}
Imports Rhino
Imports Rhino.DocObjects
Imports Rhino.Commands
Imports Rhino.Input.Custom

Namespace examples_vb
  Public Class ReadDimensionTextCommand
    Inherits Rhino.Commands.Command
    Public Overrides ReadOnly Property EnglishName() As String
      Get
        Return "vbReadDimensionText"
      End Get
    End Property

    Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result
      Dim go = New GetObject()
      go.SetCommandPrompt("Select annotation")
      go.GeometryFilter = ObjectType.Annotation
      go.[Get]()
      If go.CommandResult() <> Result.Success Then
        Return Result.Failure
      End If
      Dim annotation = TryCast(go.[Object](0).[Object](), AnnotationObjectBase)
      If annotation Is Nothing Then
        Return Result.Failure
      End If

      RhinoApp.WriteLine("Annotation text = {0}", annotation.DisplayText)

      Return Result.Success
    End Function
  End Class
End Namespace
from Rhino import *
from Rhino.DocObjects import *
from Rhino.Commands import *
from Rhino.Input.Custom import *
import rhinoscriptsyntax as rs

def RunCommand():
  go = GetObject()
  go.SetCommandPrompt("Select annotation")
  go.GeometryFilter = ObjectType.Annotation
  go.Get()
  if go.CommandResult() <> Result.Success:
    return Result.Failure
  annotation = go.Object(0).Object()
  if annotation == None or not isinstance(annotation, AnnotationObjectBase):
    return Result.Failure

  print "Annotation text = {0}".format(annotation.DisplayText)

  return Result.Success

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

Rhino for Mac

Supported in: 5.4

Rhino for Windows

Supported in: 6.8
See Also