Running the following script from ScriptEditor, EditPythonScript or from a button:
#! python 3
"""Script to insert a TextObject as curves using rs.Command()
Script by Mitch Heynick 03.04.26 - Rhino V8 (and maybe V9) only"""
import rhinoscriptsyntax as rs
import Rhino
def AddTextObjectAsCurves():
if Rhino.RhinoApp.ExeVersion<8:
print("Only supported in V8 or later")
return
tol=rs.UnitAbsoluteTolerance()
txt_str=rs.GetString("Enter your text")
if txt_str is None: return
ht=rs.GetReal("Text height?",minimum=tol)
if ht is None: return
ins_pt=rs.GetPoint("Pick point")
if not ins_pt: return
comm_str="_-TextObject _Height={} _Rotation=0".format(ht)
comm_str+=" _Font=Arial _Italic=_No _Bold=_No _HorizontalAlignment=_Left"
comm_str+=" _VerticalAlignment=_Bottom _CreateGeometry=_Curves _GroupOutput=_Yes"
comm_str+=" _GroupGlyphOutput=_Yes _AllowSingleStrokeFonts=_No"
comm_str+=" _LowerCaseAsSmallCaps=_No _AddSpacing=_No"
comm_str+=" _UseTextCenterToPosition=_No {} {}".format(txt_str,ins_pt)
rs.Command(comm_str,False)
AddTextObjectAsCurves()
Note the rs.Command(comm_str,False) False setting should supress the command line reporting for the command line options.
I see this when I hit F2 afterwards
Enter your text: SomeText
Text height?: 10
Pick point: 0
Height: 10
Rotation: 0
Italic: No
Bold: No
HorizontalAlignment: Left
VerticalAlignment: Bottom
CreateGeometry: Curves
GroupOutput: Yes
GroupGlyphOutput: Yes
AllowSingleStrokeFonts: No
LowerCaseAsSmallCaps: No
AddSpacing: No
UseTextCenterToPosition: No
Text string: SomeText
The first three entries are expected, the rest are not… V8 only shows the first three entries as expected. Is there some setting I am missing in the WIP to not print this stuff to the command line - as rs.Command(..., False) was designed to do? I seem to recall something in the past, but maybe my memory is failing me.