I came across what appears to be a bug in Rhino.Geometry.Mesh.CreateBooleanIntersection. I am running the attached Python code on the two meshes in the attached file. One of the meshes has two vertices very close to each other at a distance of about 0.08, this is correct.
import rhinoscriptsyntax as rs
selectedA = rs.GetObject(‘mesh a’,32)
selectedB = rs.GetObject(‘mesh b’,32)
for offsetX in [0, 200, -200]:
meshA = rs.coercemesh(rs.CopyObject(selectedA,[offsetX,0,0]))
meshB = rs.coercemesh(rs.CopyObject(selectedB,[offsetX,0,0]))
meshA = rs.coercemesh(selectedA)
meshB = rs.coercemesh(selectedB)
booleansAB = Rhino.Geometry.Mesh.CreateBooleanIntersection([meshA],[meshB])
booleansBA = Rhino.Geometry.Mesh.CreateBooleanIntersection([meshB],[meshA])
print offsetX, ((‘AB closed’ if booleansAB.IsClosed else ‘AB open’)if booleansAB else ‘AB failed’)
print offsetX, ((‘BA closed’ if booleansBA.IsClosed else ‘BA open’)if booleansBA else ‘BA failed’)
In Rhino 6, all booleans fail. In Rhino 7 curiously, I get the following result:
0 AB open
0 BA failed
200 AB open
200 BA failed
-200 AB closed
-200 BA closed
The same applies if done manually in Rhino 7: If I copy or move the objects by -200 along the x-axis they boolean fine, otherwise not.
As it might take time to fix the Rhino code, is there any quick fix I can do, such as rebuilding the mesh or similar? Thank you very much!