Rhino.Geometry.Brep.CreatePlanarDifference
does not work with disjoint (non manifold merged) breps.
In the following (WIP) file:
PLanarDifference.3dm (3.6 MB)
If you run this code:
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
def TestPlanarDifference():
base_obj_id=rs.GetObject("Select base object",8+16)
if not base_obj_id: return
sub_obj_id=rs.GetObject("Select object to subtract",8+16)
if not sub_obj_id: return
base_obj=rs.coercebrep(base_obj_id)
sub_obj=rs.coercebrep(sub_obj_id)
tol=sc.doc.ModelAbsoluteTolerance
plane=Rhino.Geometry.Plane.WorldXY
result=Rhino.Geometry.Brep.CreatePlanarDifference(base_obj,sub_obj,plane,tol)
if result:
add_ids=[sc.doc.Objects.AddBrep(obj) for obj in result]
rs.DeleteObjects([base_obj_id,sub_obj_id])
rs.SelectObjects(add_ids)
else:
print "Planar Difference Failed!"
TestPlanarDifference()
If you select the two surfaces in the layers “Simple” it succeeds.
If you select the non manifold merged objects on the “NMM” layers, it fails.
The same actually goes for CreatePlanarIntersection()
and CreatePlanarUnion()
. Methinks this should be made to work. Tested in V7 and V8 WIP.