The left part of the script generates panels for a surface and moves them to the center of said surface.
The right part is meant to remove all panels outside the boundary of that surface. However, the results are not working exactly as planned.
this takes all the corner points of each panel and checks if each of them lies inside the rectangle that defines your boundary surface
if one or more corner points is not contained, that whole panel is culled form the list:
this might work for surfaces with holes, but be sure to set a Distance threshold that works well for your model and is also adequate for the Tolerance of your Rhino file
[I assume you are still looking for a way to cull panels which are not completely contained on a -this time pierced- surface]