How to confirm one surface is included in other surface

Hi!

I have been trying to find a way to confirm one surface is included in other surface.
Can anyone help me to solve the problem.
Thank you in advance!!!

Following is the code:

import rhinoscriptsyntax as rs
arrWindows = rs.ObjectsByLayer("Windows")
surface = rs.ObjectsByLayer("wall")

def sel_window(surface,arrWindows):
        for window in arrWindows:
            arrCurves=extractCurves(window)
            allptonsurface=True
            arrPoints=[]
            for curve in arrCurves:
                arrPoint = rs.CurveStartPoint(curve)
                if rs.IsPointInSurface(surface,arrPoint,True,0.1):
                    arrPoints.append(arrPoint)
                else:
                    allptonsurface=False
                    break
            if allptonsurface==True:
                return window

def extractCurves(obj):
        arrBorders = rs.DuplicateSurfaceBorder(obj)
        arrCurves = rs.ExplodeCurves(arrBorders)
        rs.DeleteObjects(arrBorders)
        return arrCurves

sel_window(surface,arrWindows)

I’m not sure if the surfaces in question are planar - I am assuming in this case that they are - so you might be able to use the rhinoscriptsyntax method rs.PlanarClosedCurveContainment(). Get the wall surface border as a single closed planar curve and check the extracted window curves against it. The window curves would also have to be closed and planar and in the same plane as the wall, so at their extraction you would not want to explode them as you do above. See the help for more info on the method.

There is no direct way that I know to determine if one planar surface is inside another’s border.

–Mitch

1 Like