Quantcast
Viewing all articles
Browse latest Browse all 5797

Insert Carriage Return for python text string on Windows

@rhinorudi wrote:

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.

At first I thought it was a carriage return issue between Mac & Windows.

When I open the file in Rhino for Windows, with the text from the script run on a Mac, it look like this in text properties.

So the above was from the script run in Rhino for Mac.

If I run the same script in Windows, I get the same thing in the text properties panel.

This makes it hard to edit any of the text in Windows, quickly.

SO the question is, can I add a carriage return to the script to make the Windows text look like the Mac text in the properties panel?

Text portion of code …

point = rs.GetPoint("Point for text insertion")
if point:
    tObjs=[]
    #create your text string
textString='''Calculated {mType} Weight:
{grams} grams in Rhino
{finished} grams finished

Price for silver is ${cost1} US,
based on 51¢ per gram.

{text}
Designer: {designer}
Rhino: {fileBy}
Factory: {build_for}
© JewelPop Inc. {now}
'''
context = {
        "mType":mType,
        "grams":grams,
		"finished":finished,
		"cost1":cost1,
		"text":text,
		"designer":designer,
		"fileBy":fileBy,
		"build_for":build_for,
		"now":now,
}

tObjs.append(rs.AddText(textString.format(**context),point,tHt))

Thanks
«Randy

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5797

Trending Articles