Extrusions
Extrusion operations convert 2D shapes (or Python functions) into 3D solids.
linear_extrude
Extrude a 2D shape (or Python function) along the Z axis.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj |
2D solid or function | — | Shape to extrude, or a Python function f(h) -> [[x,y], ...] |
height |
number or [x,y,z] |
1 |
Extrusion height (number for Z-axis, vector for arbitrary direction) |
convexity |
int | 1 |
Convexity for rendering |
origin |
[x, y] |
None |
Origin point for twist/scale operations |
scale |
[x, y] |
None |
Scale factor at the top of the extrusion |
center |
bool | False |
Center vertically |
slices |
int | 1 |
Number of intermediate slices |
segments |
int | 0 |
Number of segments for twist |
twist |
number or function | None |
Twist angle in degrees, or a Python function f(h) -> angle |
fn, fa, fs |
— | Curve discretization parameters |
PythonSCAD extensions:
The obj parameter can be a Python function that receives a height value and returns a list of 2D points defining the cross-section at that height:
The twist parameter can also be a Python function:
Examples:
OpenSCAD reference: linear_extrude
rotate_extrude
Extrude a 2D shape by rotating it around the Z axis.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj |
2D solid or function | — | Shape to extrude, or a Python function f(angle) -> [[x,y], ...] |
convexity |
int | 1 |
Convexity for rendering |
scale |
float | 1.0 |
Scale factor at the end of rotation |
angle |
float | 360 |
Rotation angle in degrees |
twist |
number or function | None |
Twist angle or function |
origin |
[x, y] |
None |
Origin for twist/scale |
offset |
[x, y] |
None |
Offset for the profile |
v |
[x, y, z] |
None |
Translation per revolution for helix (PythonSCAD extension) |
method |
string | None |
Extrusion method |
fn, fa, fs |
— | Curve discretization parameters |
PythonSCAD extensions:
The obj parameter can be a Python function that receives an angle and returns a 2D cross-section:
The v parameter creates a helix by translating the profile along a vector per revolution:
Examples:
OpenSCAD reference: rotate_extrude
path_extrude
Extrude a 2D shape along an arbitrary 3D path. A 4th value in each path vertex specifies the corner radius at that point.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj |
2D solid or function | — | Cross-section shape or Python function |
path |
list of [x,y,z] or [x,y,z,r] |
— | 3D path points; optional 4th element is corner radius |
xdir |
[x, y, z] |
[1, 0, 0] |
X-direction vector for profile orientation |
convexity |
int | 1 |
Convexity for rendering |
origin |
[x, y] |
None |
Origin for the profile |
scale |
[x, y] |
None |
Scale factor at the end |
twist |
number or function | None |
Twist angle or function |
closed |
bool | False |
Close the path into a loop |
fn, fa, fs |
float | -1 |
Curve discretization |
Examples:
skin
Create a surface that smoothly connects multiple 2D profiles placed in 3D space. This is essentially morphing between shapes.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj1, obj2, ... |
2D solids | — | Profiles to skin between (positioned in 3D space) |
convexity |
int | 1 |
Convexity for rendering |
align_angle |
float | None |
Angle to align profiles |
segments |
int | None |
Number of interpolation segments |
interpolate |
float | None |
Interpolation factor |
Examples: