I have a script that prints a text string. When I run the script on Rhino for Mac all is correct for layout when I view the text in the properties panel.
I usually set things up with a single long string and add \n for each carriage return. This works fine in text blocks. However, it looks like the Object Properties panel in Windows Rhino does not recognize \n as a carriage return. As a workaround, I found that using \r\n does seem to work on Windows though - as well as in MacRhino - example below…
–Mitch
import rhinoscriptsyntax as rs
import datetime
mType="Unobtanium"
grams="10"
finished="9.9"
cost1="50,000,000"
designer="Nobody"
fileBy="Someone"
build_for="Client"
my_str="Calculated {} Weight\r\n".format(mType)
my_str+="{} grams in Rhino\r\n".format(grams)
my_str+="{} grams finished\r\n".format(finished)
my_str+="Price for {} is ${} US\r\n\r\n".format(mType,cost1)
my_str+="Designer: {}\r\n".format(designer)
my_str+="Rhino: {}\r\n".format(fileBy)
my_str+="Factory: {}\r\n".format(build_for)
my_str+="Copyright JewelPop Inc. {}".format(datetime.date.today())
tObjs=[]
point=rs.coerce3dpoint([0,0,0])
tObjs.append(rs.AddText(my_str,point,5))
You can round and specify the number of digits within the format statement - I like this feature very much. To do so, instead of just having a blank {}, you can put in formatting codes.
For example to limit the output to a specified number of places past the decimal (and round) it might look like this: