Adding text object to block definition

We need Geometrybase and Attributes for creating block definition when we have geometry objects.
Bur what to do when we have Text entity or Text annotation

        var geometry = new System.Collections.Generic.List<Rhino.Geometry.GeometryBase>();
        var attributes = new System.Collections.Generic.List<Rhino.DocObjects.ObjectAttributes>();
      ...................
        int idef_index = doc.InstanceDefinitions.Add(idef_name, string.Empty, base_point, geometry, attributes);

When we create a Text we say this
Guid id= doc.Objects.AddText(text, plane, height, font, false, false, att8);
Now how to retrieve the GeometryBase from a guid for text?
In short, How can I add text objects with the block definition?

TextEntity is a subclass of GeometryBase, so that is usable

ObjRef tRef;
Result res = RhinoGet.GetOneObject("Select text", false, ObjectType.AnyObject, out tRef);
if (res != Result.Success || null == tRef)
    return res;

TextEntity te = tRef.TextEntity();
if (null == te)
    return Result.Failure;

int iDef = doc.InstanceDefinitions.Add("Text Instance", "A text-based instance", Point3d.Origin, te,
    new ObjectAttributes());


return Result.Success;
1 Like

Many Thanks ! It works!