Boolean Union
This operation combines two or more objects into a single object. It’s equivalent to the mathematical union operation.
RhinoCommons
import Rhino
import scriptcontext
# Prompt to select the set of polysurfaces to union
breps = Rhino.Input.RhinoGet.GetMultipleObjects("Select the set of polysurfaces to union", False, Rhino.DocObjects.ObjectType.Brep)
# Extract the breps from the object references
breps = [obj_ref.Brep() for obj_ref in breps[1]]
# Create the boolean union
union = Rhino.Geometry.Brep.CreateBooleanUnion(breps, scriptcontext.doc.ModelAbsoluteTolerance)
# Bake the union to the document
if union:
for brep in union:
scriptcontext.doc.Objects.AddBrep(brep)
rhinoscriptsyntax
import rhinoscriptsyntax as rs
# Prompt to select the set of polysurfaces to union
guids = rs.GetObjects("Select the set of polysurfaces to union", 16)
# Perform boolean union
union = rs.BooleanUnion(guids)
🛠 Exercises
00: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍 00: 🦏⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🦏
01: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍 01: 🦏⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🦏
02: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍 02: 🦏⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🦏
Solutions:
00: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍 00: 🦏⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🦏 01: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍 01: 🦏⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🦏 02: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍 02: 🦏⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🦏