Brep/Surface collision detection in Python script inside grasshopper

I would like to check inside Python script whether my input surface collides with any of brep inside given input breps set. No geometry really needed in result, just a true/false confirmation.
Unfortunately I have troubles with simple Intersect function, but I’m also curious is it the most efficient way.
Would be really grateful for any tips.

(Final goal is to rotate the surface looking for an uncollided position with increasing precision, up to the max precision point, in which I consider this surface cannot find an uncollided state. This is important in urban analisis.)


import Rhino
def collide(breps, surface):
  for brep in breps:
    success, crvs, pts = Rhino.Geometry.Intersect.Intersection.BrepSurface(brep, surface, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance)
    if success and (crvs or pts):
      return True
  return False
a = collide(breps, surface) (11.7 KB)

Thank you a lot. This example was exactly what I needed.