Rs.MeshMeshIntersection help file typo?


At the rs.MeshMeshIntersection help file, there stands, that this function returns “None” when not successful (I guess this means too: when two meshes do not intersect?), or on error.

But when I took a look at the file, looks like when two meshes do not intersect, this function returns an empty list, not None:

def MeshMeshIntersection(mesh1, mesh2, tolerance=None):
    """Calculates the intersections of a mesh object with another mesh object
      mesh1, mesh2 = identifiers of meshes
      tolerance[opt] = the intersection tolerance
      List of 3d point arrays that define the vertices of the intersection curves
    mesh1 = rhutil.coercemesh(mesh1, True)
    mesh2 = rhutil.coercemesh(mesh2, True)
    if tolerance is None: tolerance = Rhino.RhinoMath.ZeroTolerance
    polylines = Rhino.Geometry.Intersect.Intersection.MeshMeshAccurate(mesh1, mesh2, tolerance)
    if polylines: return list(polylines)
    return []  # this line

Or did I get it all wrong?

(Dale Fugier) #2

We should probably fix the function and leave the help file as is. I’ve added this to the bug list.


– Dale

(Steve Baer) #3

MeshMeshIntersection will return None instead of an empty list in SR9 (we’re too late for SR8). In either case, if you just have your code test the result like

results = rs.MeshMeshIntersection(.....)
if results:
  print "got results"

then your script will work the same if no matter if the function returns an empty list or None