IP (infinite plane), how is it calculated?

i have a script to set a cplane to a planar surface, if the surface isn’t planar the script quits. i want to make sure my splits are planar.

i noticed that on the nonplanar surfaces that i can’t set a cplane to i can set an infinite plane to.

so how is the IP calculated on a non-planar surface?

thank you

Hello -

So CPlane>Object , right? can you post an example of one that works for IP and not CPlane? It may be they use different tolerances for determining planarity…

-Pascal

it’s a script i had some help with from you and mitch. it prompts to select a planar surface to set the cplane on. here’s the script, maybe the tolerance on it is too tight? i’m not too sure how to troubleshoot it. there has been times where the script stopped because it said it was nonplanar. but i’ve dupped the border and made a planar surface fine.

so IP will fail if it’s non-planar?

setCPlaneToPlanarSrf.py (1.0 KB)

here’s an example with a file
ip_example.3dm (85.1 KB)

here’s another oddity. try to set the cplane to planar surface, script throws error that it’s not planar. i extract the offending surface, untrim, and it reports as planar.

Hello - it looks to me like the check for planarity in the script is incorrect… still poking…
yeah, looks like a bug to me - if no tolerance is provided for the planarity check, it is supposed to use the model absolute tolerance but it seems to be using something more strict - if I specify the tolerance, in the script as the model absolute tolerance, it all works.

Change this line:

if rs.IsSurfacePlanar(face):

to

if rs.IsSurfacePlanar(face, tol):

Is that better?

-Pascal

that last screen grab was bad.

Seems odd to me too, seeing as below is the code for rs.IsSurfacePlanar():

def IsSurfacePlanar(surface_id, tolerance=None):
    """(comments snipped)"""
    surface = rhutil.coercesurface(surface_id, True)
    if tolerance is None:
        tolerance = scriptcontext.doc.ModelAbsoluteTolerance
    return surface.IsPlanar(tolerance)

Yep, poking at it now… if I extract the face it works without tolerance as well. I’ll let the bigger brains have a look. Hm. Now it’s not the tolerance, it’s whether the face is attached to the rest of the brep or not, that seems to determine success…
RH-62455 rs.IsPlanar() discrepancy

-Pascal

cool. i use it on solid polysurfaces all the time so it just seems to be certain faces.

is that what you are seeing as well?

and thank you.