Problem with AddText and backslashes

Please give this a try:

import rhinoscriptsyntax as rs

text ="C:\test\1234"
pt = 10,10,0
rs.AddText(text, pt, 2.5,"Arial", 4)

I’ve noticed that the AddText method seems to fail if the string of text contains a backslash:

Thanks,

Dan

add a double black slash, there are some combinations in python regarding the black lash and a letter or symbol that have other meanings, look at the table below. If you see in your text you have a back slash and a T and that means a tabular space.

text =“C:\\test\\1234”

59

Yeah, that works in V5, but it doesn’t in V6 here…

Edit - this seems to work in V6:

import rhinoscriptsyntax as rs

text =r"C:\\test\\1234"
pt = 10,10,0
rs.AddText(text, pt, 2.5,"Arial", 4)

But normally the “r” prefix (raw string) should allow you to use the text without double backslashes… :confused:
(which it does in V5)
–Mitch

1 Like

Added YT item RH-41685

/Nathan

Yeah, I tried the double backslash and found that it also failed in V6, although it worked in V5. I didn’t know about the r prefix (or maybe I did but don’t remember). Thanks for that info.

Either way, the fact the V5 code fails in V6 is the real issue here, and it’s being addressed, so that’s good.

Thanks,

Dan

1 Like

RH-41685 is fixed in the latest WIP

1 Like