Transformations
All transformations are available both as standalone functions and as methods on solid objects.
translate
Move an object by a displacement vector.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj |
solid | The object to translate |
v |
[x, y, z] |
Displacement vector |
Examples:
OpenSCAD reference: translate
rotate
Rotate an object by angles in degrees.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj |
solid | The object to rotate |
a |
number or [x, y, z] |
Rotation angle(s) in degrees. A single number rotates around v; a list rotates around each axis |
v |
[x, y, z] |
Axis of rotation (when a is a single number) |
ref |
[x, y, z] |
Reference point for rotation |
Examples:
OpenSCAD reference: rotate
scale
Scale an object by factors along each axis.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj |
solid | The object to scale |
v |
number or [x, y, z] |
Scale factor(s) |
Examples:
OpenSCAD reference: scale
mirror
Mirror an object across a plane defined by a normal vector passing through the origin.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj |
solid | The object to mirror |
v |
[x, y, z] |
Normal vector of the mirror plane |
Examples:
OpenSCAD reference: mirror
resize
Resize an object to fit exact dimensions.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj |
solid | — | The object to resize |
newsize |
[x, y, z] |
— | Target dimensions. Use 0 for an axis to keep its original size |
auto |
bool or [bx, by, bz] |
False |
Auto-scale axes with 0 size proportionally |
convexity |
int | 2 |
Convexity for rendering |
Examples:
OpenSCAD reference: resize
multmatrix
Apply a 4x4 transformation matrix to an object.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj |
solid | The object to transform |
m |
4x4 list | Transformation matrix [[a,b,c,d],[e,f,g,h],[i,j,k,l],[0,0,0,1]] |
Examples:
OpenSCAD reference: multmatrix
divmatrix
Apply the inverse of a 4x4 transformation matrix. This is a PythonSCAD extension that simplifies undoing a multmatrix operation.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj |
solid | The object to transform |
m |
4x4 list | Transformation matrix whose inverse will be applied |
Examples:
color
Apply a color to an object.
Syntax:
Parameters:
| Parameter | Type | Description |
|---|---|---|
obj |
solid | The object to color |
c |
string or [r, g, b] or [r, g, b, a] |
Color name (e.g. "red", "Tomato"), hex string ("#ff0000"), or RGB/RGBA list (0.0-1.0) |
alpha |
float | Opacity (0.0 = transparent, 1.0 = opaque) |
Examples:
OpenSCAD reference: color
See also: solid.c — read or write the color of a color() node after construction.
offset
Offset a 2D shape inward or outward.
Syntax:
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
obj |
2D solid | — | The 2D shape to offset |
r |
float | None |
Offset with rounded corners (positive = outward, negative = inward) |
delta |
float | None |
Offset with sharp corners |
chamfer |
bool | False |
Use chamfered corners instead of sharp (only with delta) |
fn, fa, fs |
float | global | Curve discretization; defaults to the global fn/fa/fs values |
Exactly one of r or delta should be provided.
Examples:
OpenSCAD reference: offset
Convenience Transforms
PythonSCAD provides shorthand functions for single-axis translations:
right / left / front / back / up / down
Syntax:
Examples:
Convenience Rotations
Single-axis rotation shortcuts:
rotx / roty / rotz
Syntax:
Examples: