Set text string for TextEntity object


(Willem Derks) #1

Hi,

I’m looking for a means to set the textstring for a V6 annotation text object.
All I could find is …TextEntity.SetRichText() yet I cannot get that to work.

Is anything already in place to set the string for a TextEntity objects?

Thanks
-Willem


#2

Hi @Willem,

TextEntity.Text seems to work here in V6 to change the text done with _Text command:

import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    id = rs.GetObject("Select Text entity", 512, True, False)
    if not id: return
    
    te = rs.coercegeometry(id, True)
    te.Text = "TestTestTest"
    
    scriptcontext.doc.Objects.Replace(id, te)
    scriptcontext.doc.Views.Redraw()
    
DoSomething()

There is another example here which works without replacing.

c.


(Steve Baer) #3

Hi Willem,
The next WIP will have a bunch of changes with respect to the annotation classes in RhinoCommon. All of the V6Annotation classes will be gone and all of the new functionality has been merged into the older annotation classes. You should be able to set the text using the Text property like in the past.