Click or drag to resize

AnnotationObjectBaseDisplayText Property

Gets the text that is displayed to users.

Namespace:  Rhino.DocObjects
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public string DisplayText { 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;
    }
  }
}
Python
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()
See Also