Adding a text entity via Rhino.Geometry.TextEntity.Create()

The method wants the following:

But I’m not sure what to reference for DimensionStyle

I tried Rhino.DocObjects.Tables.DimStyleTable.Current but that didn’t work

Creating a DimStyle from scratch requires a million things…

What am I missing here?

I actually need to do this in GH and get text out…

// #! csharp
using System;
using Rhino.Geometry;
using Rhino.DocObjects;
using Rhino;



RhinoDoc doc = RhinoDoc.ActiveDoc;
DimensionStyle docStyle = Rhino.RhinoDoc.ActiveDoc.DimStyles.Current;

TextEntity txt = TextEntity.Create("hello world", Plane.WorldXY,docStyle, false, 100,0);

Guid idTxt = doc.Objects.AddText(txt);

RhinoApp.WriteLine(" new txt with id {0}",idTxt);

DimensionStyle style = new DimensionStyle();
style.Name = "demo";
style.Id = new Guid();
style.CopyFrom(docStyle);
Plane pl = Plane.WorldXY;
pl.Origin = new Point3d(0,30,0);
TextEntity txt2 = TextEntity.Create("hello world 2", pl,style, false, 100,0);
Curve[] crvs = txt2.CreateCurves(style,false,1.0,1.0);

foreach (Curve crvi in crvs) doc.Objects.AddCurve(crvi);

doc.Views.Redraw();

above does do an initial job here.
Not sure about the 1.0,1.0 in CreateCurves.

does this help as a startingpoint ?

1 Like

Thanks for that. I will see how that works converted to Python However, I think I am going to try a different approach actually.