P_Rhino_Geometry_TextEntity_Justification - mcneel/rhinocommon-api-docs GitHub Wiki

TextEntity.Justification Property

Gets or sets the justification of text in relation to its base point.

Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll) Version: Rhino 6.0

Syntax

C#

public TextJustification Justification { get; set; }

VB

Public Property Justification As TextJustification
	Get
	Set

Property Value

Type: TextJustification

Examples

VB

Imports Rhino
Imports Rhino.Commands
Imports Rhino.Geometry

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

    Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result
      Dim text_entity = New TextEntity()
      text_entity.Plane = Plane.WorldXY
      text_entity.Text = "Hello Rhino!"
      text_entity.Justification = TextJustification.MiddleCenter
      text_entity.FontIndex = doc.Fonts.FindOrCreate("Arial", False, False)

      doc.Objects.AddText(text_entity)
      doc.Views.Redraw()

      Return Result.Success
    End Function
  End Class
End Namespace

C#

using Rhino;
using Rhino.Commands;
using Rhino.Geometry;

namespace examples_cs
{
  public class TextJustifyCommand : Command
  {
    public override string EnglishName { get { return "csTextJustify"; } }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      var text_entity = new TextEntity
      {
        Plane = Plane.WorldXY,
        Text = "Hello Rhino!",
        Justification = TextJustification.MiddleCenter,
        FontIndex = doc.Fonts.FindOrCreate("Arial", false, false)
      };

      doc.Objects.AddText(text_entity);
      doc.Views.Redraw();

      return Result.Success;
    }
  }
}

Python

from scriptcontext import doc
from Rhino.Geometry import *

text_entity = TextEntity()
text_entity.Plane = Plane.WorldXY
text_entity.Text = "Hello Rhino!"
text_entity.Justification = TextJustification.MiddleCenter
text_entity.FontIndex = doc.Fonts.FindOrCreate("Arial", False, False)

doc.Objects.AddText(text_entity)
doc.Views.Redraw()

Version Information

Supported in: 6.0.16224.21491, 5D58w

See Also

Reference

TextEntity Class
Rhino.Geometry Namespace

⚠️ **GitHub.com Fallback** ⚠️