Leader text created in Python vs Rhinoscript


#1

We’ve been noticing a difference in behaviour between leader text created in Python vs. Rhinoscript with regard to maintaining the line separations. It’s probably best to watch these two screencasts.

First Rhinoscript:
http://screencast.com/t/HafXFZPbuzsJ

Notice how the format of the label (line separation and spacing) remains intact despite resizing the edit box. This is text string had the lines separated using VbCrLf.

Now look at how the Python version behaves:
http://screencast.com/t/kB1r8hWN2

This is a mess without even resizing the edit box. Resizing it goes from bad to worse. I’ve tried both \n and os.linesep in Python but the results are both the same, and the format of the label is lost as soon as the edit box appears. For what it’s worth, editing in the Properties pane is also a mess.

Is there a way in Python to achieve results closer to VB’s VbCrLf functionality? We need the format to withstand editing, as editing is a common occurrence on these types of labels.

Thanks,

Dan


#2

Here is a sample of each label in case anyone wants to play around with it.

text samples.3dm (79.5 KB)


#3

Hey Dan,
Don’t know anything about python, but it looks like it may simply be the difference between “\r\n” (carriage return / line feed) and a simple “\n” (newline). How are you defining your line breaks in python? If you are using the common “\n”, try “\r\n” .
Hope that helps,
tom

No, the typewriter has not left us… :smile:


#4

Hi Tom,

This is exactly what I needed. I wasn’t aware that the “carriage return” transcended time and still existed in Python.

Thanks for pointing this out.

Dan