Import text into Grasshopper from a Rhino file is possible?

Who met (and solved) the following problem:

Import text into Grasshopper from a Rhino file.

Thank in advance!
Frank

It is possible to retrieve text object properties using its GUID:

import Rhino
rhino_object = Rhino.RhinoDoc.ActiveDoc.Objects.FindId(id)
if (rhino_object, Rhino.DocObjects.TextObject):
    text = rhino_object.Geometry
    if isinstance(text, Rhino.Geometry.TextEntity):
        a = text.PlainText
private void RunScript(Guid id, ref object A)
{
  var rhinoObject = RhinoDocument.Objects.FindId(id);
  if (rhinoObject is TextObject)
  {
    var text = rhinoObject.Geometry as TextEntity;
    A = text.PlainText;
  }
}

guidToText.gh (10.0 KB)

Rhino 8 introduces the new Text Entity parameter to make working with text objects easier (read more…):

1 Like

Dear Mahdiyar,

Thank you very mtch for the solution!

Frank

There are a whole bunch of new components in GH1 for Rhino8 which add more integration between GH and Rhino. Support for annotations is part of that.

3 Likes

Thanks David!

After our company will upgrade to Rhino8, we will use these new features.