Python equivalent of gh "isPlanar"

Hi,

Is there a way in python to test if a srf is planar? I’m thinking of the isPlanar component in gh, but can’t find anything in python.

tx,

dh

the float you put in is the tolerance.

Thank you!

fyi, you can also search the rhinocommon api. (you mentioned you “couldn’t find anything python”, but I’m not sure what that meant.)

https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_Curve_IsPlanar.htm

Ivelin,

I am getting an error when I run .IsPlanar on a srf. Can you see what I’m doing wrong?

tx,

dh

You have to convert the guid into an object. Perhaps you haven’t set the type in the input.

Right-click the “X” input go to the bottom of the context menu and select that the type should be surface.

oh, right, of course… Thanks!

1 Like

In rhinoscriptsyntax it’s

rs.IsSurfacePlanar(srfID,tolerance) 
#tolerance argument optional, defaults to file abs. tolerance

As a kind of a bonus:
You can also easily implement this functionality completely for yourself. Its a great practice on programming in Rhino.

A surface is planar if all controlpoints are in a plane. You can check for a point in plane, by for instance picking 3 points create a plane and change basis it to the world plane and evaluating z.
Another way, and even more shorter: A surface is planar if the distance between the controlpoint and its corresponding greville point is zero. At least if its not an uncurved kinked surface. Which is extremely unlikely bytheway…

1 Like