Boolean Operations
Boolean operations combine multiple solids using constructive solid geometry (CSG).
PythonSCAD boolean fillets (r, fn): On union, difference, and intersection, optional r / fn round only the boolean seam corners (edges created where operands meet). This works for 3D solids (Manifold backend) and 2D outlines (Clipper). Pre-existing corners that are not on a seam are left sharp — unlike offset(r=...), which rounds every corner.
union
Combine multiple objects into one. The result contains all volume from all inputs.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj1, obj2, ... |
solids | — | Objects to combine |
r |
float | — | Fillet radius for boolean seam edges (PythonSCAD extension) |
fn |
int | — | Number of segments for fillet rounding (PythonSCAD extension) |
Examples:
OpenSCAD reference: union
difference
Subtract one or more objects from the first object.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj1 |
solid | — | Base object |
obj2, ... |
solids | — | Objects to subtract |
r |
float | — | Fillet radius for boolean seam edges (PythonSCAD extension) |
fn |
int | — | Number of segments for fillet rounding (PythonSCAD extension) |
Examples:
from pythonscad import *
difference(cube(10), sphere(7)).show()
# Operator form
(cube(10) - sphere(7)).show()
# Filleted seams (3D)
difference(cube(10), cylinder(r=4, h=12, center=True), r=0.5, fn=8).show()
# Filleted seams (2D)
difference(square(10, center=True), square(10, center=True).rotz(45).back(10), r=1.4, fn=8).show()
OpenSCAD reference: difference
intersection
Keep only the volume that is common to all input objects.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj1, obj2, ... |
solids | — | Objects to intersect |
r |
float | — | Fillet radius for boolean seam edges (PythonSCAD extension) |
fn |
int | — | Number of segments for fillet rounding (PythonSCAD extension) |
Examples:
OpenSCAD reference: intersection
hull
Create the convex hull of multiple objects. The result is the smallest convex solid that contains all input objects.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj1, obj2, ... |
solids | Objects to hull |
Examples:
OpenSCAD reference: hull
fill
Fill concavities in a 2D shape, creating a convex outline.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj1, obj2, ... |
2D solids | Shapes to fill |
Examples:
minkowski
Compute the Minkowski sum of two objects. Conceptually, this "traces" one object around the surface of the other, useful for rounding edges.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj1 |
solid | — | Base object |
obj2 |
solid | — | Object to trace around obj1 |
convexity |
int | 2 |
Convexity for rendering |
Examples:
OpenSCAD reference: minkowski
concat
Concatenate the meshes of multiple objects without performing boolean operations. This is useful when sub-parts are not yet watertight and CSG would fail.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj1, obj2, ... |
solids or lists | Objects to concatenate |
Examples: