Boolean Split


This operation splits one object with another object. It’s equivalent to the mathematical split operation.


RhinoCommon


import Rhino
import scriptcontext

# Prompt to select the polysurface to split
brep_to_split = Rhino.Input.RhinoGet.GetOneObject("Select the polysurface to split", False, Rhino.DocObjects.ObjectType.Brep)

# Prompt to select the cutting polysurface
cutter_brep = Rhino.Input.RhinoGet.GetOneObject("Select the cutting polysurface", False, Rhino.DocObjects.ObjectType.Brep)

# Perform the boolean split
split_breps = Rhino.Geometry.Brep.CreateBooleanSplit(brep_to_split[1].Brep(), cutter_brep[1].Brep(), scriptcontext.doc.ModelAbsoluteTolerance)

# Bake the split breps to the document
if split_breps:
    for brep in split_breps:
        scriptcontext.doc.Objects.AddBrep(brep)


rhinoscriptsyntax


import rhinoscriptsyntax as rs

# Prompt to select the polysurface to split
brep_to_split_id = rs.GetObject("Select the polysurface to split", 16)

# Prompt to select the cutting polysurface
cutter_brep_id = rs.GetObject("Select the cutting polysurface", 16)

# Perform split
split_ids = rs.SplitBrep(brep_to_split_id, cutter_brep_id)

# Delete the original brep
rs.DeleteObject(brep_to_split_id)


🛠 Exercises


01: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍 01: 🦏⬇️⬇️⬇️ Download the 3D model here ⬇️⬇️⬇️🦏


Solutions:

01: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍