V6 Bug: coerce3dpoint

Hi, this fails in Rhino V6 SR3,
worked fine in V5

import string
import rhinoscriptsyntax as rs

line = "-1.00000000 0.00000000 0.00000000 0.00000000 1.00000000 0.00000000"
list_line = string.split(line)
pt = rs.coerce3dpoint(list_line[0:3])
vt = rs.coerce3dvector(list_line[3:])
print pt,vt

-100000000,0,0 0,100000000,0

Hi Jess,

This seems to be working here:

import rhinoscriptsyntax as rs

line = "-1.00000000 0.00000000 0.00000000 0.00000000 1.00000000 0.00000000"
list_line = line.split()
pt = rs.coerce3dpoint(list_line[0:3])
vt = rs.coerce3dvector(list_line[3:])
print pt,vt
print type(pt), type(vt)

>>>-1,0,0 0,1,0
>>><type 'Point3d'> <type 'Vector3d'>

Hi Mitch,
Thanks for checking. I also get Point3d and Vector3d types. Strange…
I’ll have to use float() for each element until this is fixed.

I guess I don’t understand what is not working…

instead of 1.0 and -1.0
I get 100 Millions :confused:

Yeah, I saw that, but in my example not. I think importing the string module is not a good idea, not necessary and it is also deprecated as far as I know…




OK, thanks for the hint! I’ve stripped off the string import.
Anyways it still fails.

Really? Hmm, maybe it’s the comma/period thing, I’m on a US English OS… what if you do this?

line = r"-1.00000000 0.00000000 0.00000000 0.00000000 1.00000000 0.00000000"

i.e. use a raw string?

Still failure with the raw string. Maybe someone else with German OS can check @clement ?
I mean it works in V5, so something is broken…
Thanks, Jess

Does it work better with decimal comma instead?

line = "-1,000000 0,000000 0,000000 0,000000 1.000000 0,000000"


1 Like

Hi Nathan,
with comma as a separator it works in V6 - but then V5 returns None. The tool I’m working on should work on both versions. Looks like the localizing problems are back in V6 :frowning:

Hmm, I tried here on a French/Swiss OS, and it seemed to work with Rhino in either French or English. However, I noticed the machine was still set to decimal point as separator - I guess that’s standard for CH…

I changed it to comma, rebooted the machine, but that didn’t seem to make any difference either though.

Edit: @jess - what if you run rs.LocaleID(1033) at the top of your script? Does that change anything?

1 Like

rs.LocaleID() just returns the currently used interface language. You cannot set that. Also it would not change the python behavior.

Looks like __host.Coerce3dPointFromEnumerables(point) is causing the problem.
However, if I use float() for each element of my strings it works.

I don’t want to get into that localization nightmare again… However, everyone converting strings to points or vectors should be aware of the current behavior of V6.

Thanks for all the help!

Oh, yeah, sorry, I got that wrong, just remembering from my vb days, it was SetLocale(xxxx) which was able to set the locale during script execution - but it was not a Rhinoscript function, it was a native vbscript method.

There is this:
No idea if it works though.

That sounds weird since coerce3dpoint already uses float() on the elements of the enumerable.

Do you have Rhino interface language also set to German?

NO! That’s another nightmare for me :wink:

What does print(values) output?

[’-1.00000000’, ‘0.00000000’, ‘0.00000000’, ‘0.00000000’, ‘1.00000000’, ‘0.00000000’]

I just tested and can confirm. I added RH-45112.
It will be fixed in the next SR – I need to confirm which one is “next”, if 3 or 4.

1 Like


This sample works. Can you just check that it works also for you?

import rhinoscriptsyntax as rs

import System as s
ic = s.Globalization.CultureInfo.InvariantCulture
cc = s.Threading.Thread.CurrentThread.CurrentCulture
s.Threading.Thread.CurrentThread.CurrentCulture = ic

line = "-1.00000000 0.00000000 0.00000000"
list_line = line.split()
pt = rs.coerce3dpoint(list_line)
print pt
print type(pt)

s.Threading.Thread.CurrentThread.CurrentCulture = cc
1 Like