Collecting text tag data in Grasshopper as input

How could I potentially go about collecting ‘text tags’/‘text labels’ that are ‘attached’ to points in Rhino? Right now I’m just scooping everything up (‘everything’ being points, line segments, polylines and polycurves) in the Geometry Component. Is there a way to collect text tags/text in the same way and associate them with points or coordinate locations?

For example:

text_dispaly

Based on the pictures above, what I potentially aim to do is that I can collect both the points (as coordinates or as objects, either is okay) and the text together, and know which point goes with which text. I am coding in Python, and am attempting to do this primarily with the Geometry Collection component and custom scripted components.

From what I understand, the Text Tag/Text Tag 3D components don’t have any explicit output (say, the points with the text now stored on them) so is there a RhinoDoc or scriptcontext thing I’m missing?

From what I can understand, you’d like to be able to reference Text objects drawn in Rhino and have the location and text available in GH?

As you can see, GH has no default way to do this in its current incarnation. There are several GH Add-Ons (Elefront, Human, among others probably) which enable this, but it is also pretty straightforward to do this with a few lines of code. The attached definition references Text objects via their guid in a c# component. Since this is using RhinoCommon, you should be able to do the same with a GH_Python component with a bit of adaptation.

refTxt.gh (4.6 KB)

1 Like

Hi @fraguada, yes, that’s what I’m trying to do, but without using other components since the scripted component I’m building needs to be able to do it internally. Thank you for the help.

reference_text_ghpython.gh (5.8 KB)
I’ve adapted the code and am posting the solution in case it helps anyone.

4 Likes