Leader text formatting using IronPython/RhinoCommon?

How is this done? I do not see appropriate methods under the leader doc object.

See the docs for ObjectTable.AddLeader.

– Dale

Thanks for the reply @dale,

What I meant was adjusting the position of the text but also setting the font, scale, prefix, suffix, etc.

import Rhino
import scriptcontext as sc

def EditLeader():
    filter = Rhino.DocObjects.ObjectType.Annotation
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select leader to edit", False, filter)
    if not objref or rc!=Rhino.Commands.Result.Success: return rc
    obj = objref.Object()
    if type(obj) is not Rhino.DocObjects.LeaderObject:
        return Rhino.Commands.Result.Failure
    txt = ''
    rc, txt = Rhino.Input.RhinoGet.GetString("New text", False, txt)
    if rc!=Rhino.Commands.Result.Success: return rc
    leader = obj.LeaderGeometry
    leader.SetRichText(txt, leader.DimensionStyle)
    sc.doc.Objects.Replace(objref, leader)
if __name__=="__main__":

EditLeader.py (712 Bytes)

1 Like