Calling structure constructors using named arguments: Python 2 vs. 3

8.9.24194.18121, 2024-07-12

import Rhino

torusA = Rhino.Geometry.Torus(
    basePlane=Rhino.Geometry.Plane.WorldXY,
    majorRadius=20.0,
    minorRadius=10.0)

sEval = "torusA.IsValid"; print("{}: {}".format(sEval, eval(sEval)))

torusB = Rhino.Geometry.Torus(
    Rhino.Geometry.Plane.WorldXY,
    majorRadius=20.0,
    minorRadius=10.0)

sEval = "torusB.IsValid"; print("{}: {}".format(sEval, eval(sEval)))

Python2 result:

torusA.IsValid: True
torusB.IsValid: True

Python3 result:

torusA.IsValid: False
torusB.IsValid: True

This isn’t limited to Geometry.Torus; calling (all?) other structure constructors also creates invalid geometry when the first parameter name is included.

1 Like

Thanks for reporting this. I logged it here and will get it fixed

RH-83233 Calling struct ctor with only kwargs create invalid data

1 Like