RhinoCommon CreateBooleanDifference question

I am experimenting with RhinoCommon in Python… I am doing essentially the same thing as Rhino’s BooleanDifference command, but I ran across something I wasn’t expecting…

If you have two disjoint volumes, Rhino’s BooleanDifference (also union, intersect) doesn’t do anything - correct, it shouldn’t. If you do the same thing with vb Rhinoscript, the same thing occurs, you get a Null return from the operation.

However, in RhinoCommon a volume IS created, one that is the same as the base volume… So if you delete the original input objects, the volume to subtract disappears, leaving a new object (new ID) identical to the base volume… This is also the case with the Python Rhinoscriptsyntax method, as it just calls the RhinoCommon method.

Shouldn’t the RhinoCommon method return None if there is no intersection between the volumes?

Below is the code I used to test…

Thanks, --Mitch


import rhinoscriptsyntax as rs
import Rhino, scriptcontext

msg="Select base volume, then difference volume"

solid0 = rs.coercebrep(srfs[0])
solid1 = rs.coercebrep(srfs[1])

solDiff = Rhino.Geometry.Brep.CreateBooleanDifference(solid0, solid1, tol)    
if solDiff:
    for i in range(len(solDiff)):


import rhinoscriptsyntax as rs

msg="Select base volume, then difference volume"


Option Explicit
Call Test()
Sub Test()
	Dim msg,srfs,result	
	msg="Select base volume, then difference volume"
	If IsNull(result) Then Call Rhino.Print ("Null")
End Sub

Hi Mitch
For me it’s a Python bug
Ciao Vittorio

Hey Vittorio

Yes, at least the Python rhinoscriptsyntax is “wrong” in the sense that it doesn’t do the same thing as the vb method does. But the question of whether RhinoCommon is wrong or not is more important to me… From the Brep.CreateBooleanDifference Method SDK:

Return Value
An array of Brep results or null on failure.

The question here is if not finding an intersection is to be considered a “failure”. In any case returning the original geometry if there is no intersection is not extremely useful, as if that is added to the document and substituted for the original, the original changes ID. That is NOT what the Rhino native function does.

So, are the objects checked for intersection BEFORE the BD is launched and if no intersection found is the operation cancelled? Or is the vbscript counterpart using different code?


Now we need a response from Steve
Ciao Vittorio

I’m looking into this

I see the problem; I’ll get this fixed for SR6. Thanks for finding this.

Cool, thanks Steve!