algorithmic modeling for Rhino
Its been a long time since I don't post anything so I decided to do so.
How can you introduce text from Rhino canvas (imported from another CAD software) to Gh definition.
I have a set of closed curves in Rhino that contains inside some text. I need to get the curves (easy) and the text inside GH, to later perform a "containment check" operation to identify each text with its curve (container).
Horster plugin (http://www.food4rhino.com/project/horsterreference) have a "read text objects component" it output the location of all the texts as points and, of course, the texts itself.
By the way, I first tried something like that on ghPython :
import rhinoscriptsyntax as rs
a = rs.TextObjectText(x)
where x is the Guid if a text object but it returns null. Any ideas why? (the same operation returns the text in IronPython... is that function not yet implemented on gh).
Since you are attempting to reference objects within the Rhino document, you probably just need to change the scriptcontext, like so:
import Rhino as rc
import scriptcontext as sc
# Set the script context to the current Rhino doc
sc.doc = rc.RhinoDoc.ActiveDoc
# Do your Rhino doc business...
# Then set the script context back to the Grasshopper doc
sc.doc = ghdoc
Edit: Just tested the above. Seems to work. Attached the files. Also, hi Pep :)
hope everything is fine with your life :) are you going to Design Modelling Symposium?
You always seem to have the answer on Python questions :) Impressive. Do you know how to get the coordinate of the text/ID reference point as well?
I can do you one better ;) By reading the RhinoCommon properties of the TextObject it is pretty straight forward to extract the plane of the text, giving you the orientation as well. See attached..
Cool... and thanks for the link. Guess I should have looked for that some time ago :).
thats super helpful for topography modelling. thank you vey much.
I also use it and it works perfect!
Thanks for sharing
Thanks !!!! very helpfull :)