Grasshopper

algorithmic modeling for Rhino

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?

Kind of related to this pose: Referencing to text from Rhino, but is it possible to do this by relying on Text Tags instead, and only with the Geometry Collection component? From what I understand, I'd need to use the ID component to collect the TextObjects. 

Views: 1766

Replies to This Discussion

See this discourse thread for the answer.

Yeahp, that's actually me as well, and it's answered my question.

So long as I can get the plane that goes with the underlying geometry then I can get the origin point. Posting the solution on that other thread:

#id is a list of Annotation GUIDs

for i in id:

    object= sc.doc.Objects.Find(i)
    text = object.DisplayText

    location = object.TextGeometry.Plane.Origin # Well, location of where the text plane originates from

Here is the adapted code in case it helps anyone. 

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service