We’re rewarding the question askers & reputations are being recalculated! Read more.

Transforms modify the scale, translation, rotation, and shear of a mesh or object

Transforms

Transforms operate directly on mesh data, and are convenient and efficient ways to modify the scale, translation, rotation, and shear of the vertices relative to the mesh origin.

Transforms in User Interface

Transforms refer to the manipulation of an object or any part within there.
Examples are:

  • G to move
  • R to rotate
  • S to scale

Transformation tools on the blender wiki

Transforms in python (bpy)

To add a Vector quantity to all vertices or to scale the position of each vertex relative to the mesh origin, don't iterate over data.vertices. Instead, for speed and legibility, use a transform Matrix.

Transforms can be done individually or can be combined and applied all at once. Matrix documentation shows several ways to construct various transform matrices.

This short example can be run on the default scene, by pasting this code into the Text Editor and hitting Alt + P (or the run button).

import math
import bpy
from mathutils import Matrix

# create a rotation matrix
mat_rot = Matrix.Rotation(math.radians(45.0), 4, 'X')

mesh = bpy.data.objects['Cube'].data
mesh.transform(mat_rot)
mesh.update()

To combine transform matrices you multiply them in reverse order, this means if you want to translate and then scale do this:

# translate and scale
translation = Matrix.Translation((1.2, 3.2, 0.5))
scale = Matrix.Scale(scale_value, 4)

mesh.transform(scale * translation)
mesh.update()
history | excerpt history