RhinoCommon API
ObjectTableAddText Method (String, Plane, Double, String, Boolean, Boolean) |
Adds an annotation text object to the document.
Namespace: Rhino.DocObjects.Tables
Assembly: RhinoCommon (in RhinoCommon.dll)
Since: 5.0

public Guid AddText( string text, Plane plane, double height, string fontName, bool bold, bool italic )
Public Function AddText ( text As String, plane As Plane, height As Double, fontName As String, bold As Boolean, italic As Boolean ) As Guid
Parameters
- text
- Type: SystemString
Text string. - plane
- Type: Rhino.GeometryPlane
Plane of text. - height
- Type: SystemDouble
Height of text. - fontName
- Type: SystemString
Name of FontFace. - bold
- Type: SystemBoolean
Bold flag. - italic
- Type: SystemBoolean
Italic flag.
Return Value
Type: GuidThe Guid of the newly added object or Guid.Empty on failure.

using System; partial class Examples { public static Rhino.Commands.Result AddAnnotationText(Rhino.RhinoDoc doc) { Rhino.Geometry.Point3d pt = new Rhino.Geometry.Point3d(10, 0, 0); const string text = "Hello RhinoCommon"; const double height = 2.0; const string font = "Arial"; Rhino.Geometry.Plane plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane(); plane.Origin = pt; Guid id = doc.Objects.AddText(text, plane, height, font, false, false); if( id != Guid.Empty ) { doc.Views.Redraw(); return Rhino.Commands.Result.Success; } return Rhino.Commands.Result.Failure; } }
Partial Class Examples Public Shared Function AddAnnotationText(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result Dim pt As New Rhino.Geometry.Point3d(10, 0, 0) Const text As String = "Hello RhinoCommon" Const height As Double = 2.0 Const font As String = "Arial" Dim plane As Rhino.Geometry.Plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane() plane.Origin = pt Dim id As Guid = doc.Objects.AddText(text, plane, height, font, False, False) If id <> Guid.Empty Then doc.Views.Redraw() Return Rhino.Commands.Result.Success End If Return Rhino.Commands.Result.Failure End Function End Class
Python
import Rhino import scriptcontext import System.Guid def AddAnnotationText(): pt = Rhino.Geometry.Point3d(10, 0, 0) text = "Hello RhinoCommon" height = 2.0 font = "Arial" plane = scriptcontext.doc.Views.ActiveView.ActiveViewport.ConstructionPlane() plane.Origin = pt id = scriptcontext.doc.Objects.AddText(text, plane, height, font, False, False) if id!=System.Guid.Empty: scriptcontext.doc.Views.Redraw() return Rhino.Commands.Result.Success return Rhino.Commands.Result.Failure if __name__=="__main__": AddAnnotationText()
