Convert Text to Leader

Any quick way to convert a piece of Text to a leader?

via a script like this??

import rhinoscriptsyntax as rs

textobject = rs.GetObject('select text', 512)
text = rs.TextObjectText(textobject)
rs.AddLeader(rs.GetPoints(),text=text)
rs.DeleteObject(textobject)

Thanks! its a start. I’ll play with it a bit and see if i can it to the following. My coding studies have fallen off a bit.

This is in layouts so ideally it would get the origin of Text then add a second point (text origin, fixed offset) , which would allow for multiple selection as well.

my attempt in rs , which is failing at the AddLeader

Sub Main()
	Dim	textobjects, id, points, newpoints, text, arr1
	textobjects = Rhino.GetObjects("select text", 512)
		For Each id In textobjects
		Rhino.Print "Object Point:" & id
		points = Rhino.TextObjectPoint(id)
		text = Rhino.TextObjectText(id)
		newpoints = points
		newpoints(0) = newpoints(0) + 1
		newpoints(1) = newpoints(1) + 1
		arr1 = Rhino.MakeArray(2)
		arr1(1) = points
		arr1(2) = newpoints
		Rhino.AddLeader arr1
	Next
End Sub

image

a python version, still not quite getting it

import rhinoscriptsyntax as rs

def ConvertTexttoLeader():
    objs = rs.GetObjects("Select text",512, True, True )
    if objs is None :return
    for obj in objs:
        txt = rs.TextObjectText(obj)
        pt =rs.TextObjectPoint(obj)
        pt2 = (.25,.25,0)
        pt3 = [pt,pt2]
        plane = rs.ViewCPlane()
        rs.AddLeader(pt3,plane,txt)
        rs.DeleteObject(obj)
ConvertTexttoLeader()

pt3 = [pt, rs.PointAdd(pt2, pt)]

1 Like

uff, that was dumb. Thanks!