BMesh Operators (bmesh.ops)

This module gives access to low level bmesh operations.

Most operators take input and return output, they can be chained together to perform useful operations.

Note

This API us new in 2.65 and not yet well tested.

Operator Example

This script shows how operators can be used to model a link of a chain.

# This script uses bmesh operators to make 2 links of a chain.

import bpy
import bmesh
import math
import mathutils

# Make a new BMesh
bm = bmesh.new()

# Add a circle XXX, should return all geometry created, not just verts.
bmesh.ops.create_circle(
    bm,
    cap_ends=False,
    radius=0.2,
    segments=8)


# Spin and deal with geometry on side 'a'
edges_start_a = bm.edges[:]
geom_start_a = bm.verts[:] + edges_start_a
ret = bmesh.ops.spin(
    bm,
    geom=geom_start_a,
    angle=math.radians(180.0),
    steps=8,
    axis=(1.0, 0.0, 0.0),
    cent=(0.0, 1.0, 0.0))
edges_end_a = [ele for ele in ret["geom_last"]
               if isinstance(ele, bmesh.types.BMEdge)]
del ret


# Extrude and create geometry on side 'b'
ret = bmesh.ops.extrude_edge_only(
    bm,
    edges=edges_start_a)
geom_extrude_mid = ret["geom"]
del ret


# Collect the edges to spin XXX, 'extrude_edge_only' could return this.
verts_extrude_b = [ele for ele in geom_extrude_mid
                   if isinstance(ele, bmesh.types.BMVert)]
edges_extrude_b = [ele for ele in geom_extrude_mid
                   if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
bmesh.ops.translate(
    bm,
    verts=verts_extrude_b,
    vec=(0.0, 0.0, 1.0))


# Create the circle on side 'b'
ret = bmesh.ops.spin(
    bm,
    geom=verts_extrude_b + edges_extrude_b,
    angle=-math.radians(180.0),
    steps=8,
    axis=(1.0, 0.0, 0.0),
    cent=(0.0, 1.0, 1.0))
edges_end_b = [ele for ele in ret["geom_last"]
               if isinstance(ele, bmesh.types.BMEdge)]
del ret


# Bridge the resulting edge loops of both spins 'a & b'
bmesh.ops.bridge_loops(
    bm,
    edges=edges_end_a + edges_end_b)


# Now we have made a links of the chain, make a copy and rotate it
# (so this looks something like a chain)

ret = bmesh.ops.duplicate(
    bm,
    geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
geom_dupe = ret["geom"]
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
del ret

# position the new link
bmesh.ops.translate(
    bm,
    verts=verts_dupe,
    vec=(0.0, 0.0, 2.0))
bmesh.ops.rotate(
    bm,
    verts=verts_dupe,
    cent=(0.0, 1.0, 0.0),
    matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))

# Done with creating the mesh, simply link it into the scene so we can see it

# Finish up, write the bmesh into a new mesh
me = bpy.data.meshes.new("Mesh")
bm.to_mesh(me)
bm.free()


# Add the mesh to the scene
obj = bpy.data.objects.new("Object", me)
bpy.context.collection.objects.link(obj)

# Select and make active
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bmesh.ops.smooth_vert(bm, verts, factor, mirror_clip_x, mirror_clip_y, mirror_clip_z, clip_dist, use_axis_x, use_axis_y, use_axis_z)

Vertex Smooth.

Smooths vertices by using a basic vertex averaging scheme.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • verts (list of (bmesh.types.BMVert)) – input vertices

  • factor (float) – smoothing factor

  • mirror_clip_x (bool) – set vertices close to the x axis before the operation to 0

  • mirror_clip_y (bool) – set vertices close to the y axis before the operation to 0

  • mirror_clip_z (bool) – set vertices close to the z axis before the operation to 0

  • clip_dist (float) – clipping threshold for the above three slots

  • use_axis_x (bool) – smooth vertices along X axis

  • use_axis_y (bool) – smooth vertices along Y axis

  • use_axis_z (bool) – smooth vertices along Z axis

bmesh.ops.smooth_laplacian_vert(bm, verts, lambda_factor, lambda_border, use_x, use_y, use_z, preserve_volume)

Vertex Smooth Laplacian.

Smooths vertices by using Laplacian smoothing propose by. Desbrun, et al. Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • verts (list of (bmesh.types.BMVert)) – input vertices

  • lambda_factor (float) – lambda param

  • lambda_border (float) – lambda param in border

  • use_x (bool) – Smooth object along X axis

  • use_y (bool) – Smooth object along Y axis

  • use_z (bool) – Smooth object along Z axis

  • preserve_volume (bool) – Apply volume preservation after smooth

bmesh.ops.recalc_face_normals(bm, faces)

Right-Hand Faces.

Computes an “outside” normal for the specified input faces.

Parameters
bmesh.ops.planar_faces(bm, faces, iterations, factor)

Planar Faces.

Iteratively flatten faces.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input geometry.

  • iterations (int) – Number of times to flatten faces (for when connected faces are used)

  • factor (float) – Influence for making planar each iteration

Returns

Return type

dict with string keys

bmesh.ops.region_extend(bm, geom, use_contract, use_faces, use_face_step)

Region Extend.

used to implement the select more/less tools. this puts some geometry surrounding regions of geometry in geom into geom.out.

if use_faces is 0 then geom.out spits out verts and edges, otherwise it spits out faces.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.rotate_edges(bm, edges, use_ccw)

Edge Rotate.

Rotates edges topologically. Also known as “spin edge” to some people. Simple example: [/] becomes [|] then [\].

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • use_ccw (bool) – rotate edge counter-clockwise if true, otherwise clockwise

Returns

Return type

dict with string keys

bmesh.ops.reverse_faces(bm, faces, flip_multires)

Reverse Faces.

Reverses the winding (vertex order) of faces. This has the effect of flipping the normal.

Parameters
bmesh.ops.bisect_edges(bm, edges, cuts, edge_percents)

Edge Bisect.

Splits input edges (but doesn’t do anything else). This creates a 2-valence vert.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • cuts (int) – number of cuts

  • edge_percents (dict mapping vert/edge/face types to float) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.mirror(bm, geom, matrix, merge_dist, axis, mirror_u, mirror_v, mirror_udim)

Mirror.

Mirrors geometry along an axis. The resulting geometry is welded on using merge_dist. Pairs of original/mirrored vertices are welded using the merge_dist parameter (which defines the minimum distance for welding to happen).

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • geom (list of (bmesh.types.BMVert, bmesh.types.BMEdge, bmesh.types.BMFace)) – input geometry

  • matrix (mathutils.Matrix) – matrix defining the mirror transformation

  • merge_dist (float) – maximum distance for merging. does no merging if 0.

  • axis (enum in ['X', 'Y', 'Z'], default 'X') – the axis to use.

  • mirror_u (bool) – mirror UVs across the u axis

  • mirror_v (bool) – mirror UVs across the v axis

  • mirror_udim (bool) – mirror UVs in each tile

Returns

Return type

dict with string keys

bmesh.ops.find_doubles(bm, verts, keep_verts, dist)

Find Doubles.

Takes input verts and find vertices they should weld to. Outputs a mapping slot suitable for use with the weld verts bmop.

If keep_verts is used, vertices outside that set can only be merged with vertices in that set.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.remove_doubles(bm, verts, dist)

Remove Doubles.

Finds groups of vertices closer then dist and merges them together, using the weld verts bmop.

Parameters
bmesh.ops.collapse(bm, edges, uvs)

Collapse Connected.

Collapses connected vertices

Parameters
bmesh.ops.pointmerge_facedata(bm, verts, vert_snap)

Face-Data Point Merge.

Merge uv/vcols at a specific vertex.

Parameters
bmesh.ops.average_vert_facedata(bm, verts)

Average Vertices Facevert Data.

Merge uv/vcols associated with the input vertices at the bounding box center. (I know, it’s not averaging but the vert_snap_to_bb_center is just too long).

Parameters
bmesh.ops.pointmerge(bm, verts, merge_co)

Point Merge.

Merge verts together at a point.

Parameters
bmesh.ops.collapse_uvs(bm, edges)

Collapse Connected UV’s.

Collapses connected UV vertices.

Parameters
bmesh.ops.weld_verts(bm, targetmap)

Weld Verts.

Welds verts together (kind-of like remove doubles, merge, etc, all of which use or will use this bmop). You pass in mappings from vertices to the vertices they weld with.

Parameters
bmesh.ops.create_vert(bm, co)

Make Vertex.

Creates a single vertex; this bmop was necessary for click-create-vertex.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.join_triangles(bm, faces, cmp_seam, cmp_sharp, cmp_uvs, cmp_vcols, cmp_materials, angle_face_threshold, angle_shape_threshold)

Join Triangles.

Tries to intelligently join triangles according to angle threshold and delimiters.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input geometry.

  • cmp_seam (bool) – Undocumented.

  • cmp_sharp (bool) – Undocumented.

  • cmp_uvs (bool) – Undocumented.

  • cmp_vcols (bool) – Undocumented.

  • cmp_materials (bool) – Undocumented.

  • angle_face_threshold (float) – Undocumented.

  • angle_shape_threshold (float) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.contextual_create(bm, geom, mat_nr, use_smooth)

Contextual Create.

This is basically F-key, it creates new faces from vertices, makes stuff from edge nets, makes wire edges, etc. It also dissolves faces.

Three verts become a triangle, four become a quad. Two become a wire edge.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.bridge_loops(bm, edges, use_pairs, use_cyclic, use_merge, merge_factor, twist_offset)

Bridge edge loops with faces.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • use_pairs (bool) – Undocumented.

  • use_cyclic (bool) – Undocumented.

  • use_merge (bool) – Undocumented.

  • merge_factor (float) – Undocumented.

  • twist_offset (int) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.grid_fill(bm, edges, mat_nr, use_smooth, use_interp_simple)

Grid Fill.

Create faces defined by 2 disconnected edge loops (which share edges).

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • mat_nr (int) – material to use

  • use_smooth (bool) – smooth state to use

  • use_interp_simple (bool) – use simple interpolation

Returns

Return type

dict with string keys

bmesh.ops.holes_fill(bm, edges, sides)

Fill Holes.

Fill boundary edges with faces, copying surrounding customdata.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.face_attribute_fill(bm, faces, use_normals, use_data)

Face Attribute Fill.

Fill in faces with data from adjacent faces.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • use_normals (bool) – copy face winding

  • use_data (bool) – copy face data

Returns

Return type

dict with string keys

bmesh.ops.edgeloop_fill(bm, edges, mat_nr, use_smooth)

Edge Loop Fill.

Create faces defined by one or more non overlapping edge loops.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • mat_nr (int) – material to use

  • use_smooth (bool) – smooth state to use

Returns

Return type

dict with string keys

bmesh.ops.edgenet_fill(bm, edges, mat_nr, use_smooth, sides)

Edge Net Fill.

Create faces defined by enclosed edges.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • mat_nr (int) – material to use

  • use_smooth (bool) – smooth state to use

  • sides (int) – number of sides

Returns

Return type

dict with string keys

bmesh.ops.edgenet_prepare(bm, edges)

Edgenet Prepare.

Identifies several useful edge loop cases and modifies them so they’ll become a face when edgenet_fill is called. The cases covered are:

  • One single loop; an edge is added to connect the ends

  • Two loops; two edges are added to connect the endpoints (based on the shortest distance between each endpont).

Parameters
Returns

Return type

dict with string keys

bmesh.ops.rotate(bm, cent, matrix, verts, space)

Rotate.

Rotate vertices around a center, using a 3x3 rotation matrix.

Parameters
bmesh.ops.translate(bm, vec, space, verts)

Translate.

Translate vertices by an offset.

Parameters
bmesh.ops.scale(bm, vec, space, verts)

Scale.

Scales vertices by an offset.

Parameters
bmesh.ops.transform(bm, matrix, space, verts)

Transform.

Transforms a set of vertices by a matrix. Multiplies the vertex coordinates with the matrix.

Parameters
bmesh.ops.object_load_bmesh(bm, scene, object)

Object Load BMesh.

Loads a bmesh into an object/mesh. This is a “private” bmop.

Parameters
bmesh.ops.bmesh_to_mesh(bm, mesh, object)

BMesh to Mesh.

Converts a bmesh to a Mesh. This is reserved for exiting editmode.

Parameters
bmesh.ops.mesh_to_bmesh(bm, mesh, object, use_shapekey)

Mesh to BMesh.

Load the contents of a mesh into the bmesh. this bmop is private, it’s reserved exclusively for entering editmode.

Parameters
bmesh.ops.extrude_discrete_faces(bm, faces, use_normal_flip, use_select_history)

Individual Face Extrude.

Extrudes faces individually.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • use_normal_flip (bool) – Create faces with reversed direction.

  • use_select_history (bool) – pass to duplicate

Returns

Return type

dict with string keys

bmesh.ops.extrude_edge_only(bm, edges, use_normal_flip, use_select_history)

Extrude Only Edges.

Extrudes Edges into faces, note that this is very simple, there’s no fancy winged extrusion.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input vertices

  • use_normal_flip (bool) – Create faces with reversed direction.

  • use_select_history (bool) – pass to duplicate

Returns

Return type

dict with string keys

bmesh.ops.extrude_vert_indiv(bm, verts, use_select_history)

Individual Vertex Extrude.

Extrudes wire edges from vertices.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.connect_verts(bm, verts, faces_exclude, check_degenerate)

Connect Verts.

Split faces by adding edges that connect verts.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.connect_verts_concave(bm, faces)

Connect Verts to form Convex Faces.

Ensures all faces are convex faces.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.connect_verts_nonplanar(bm, angle_limit, faces)

Connect Verts Across non Planer Faces.

Split faces by connecting edges along non planer faces.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.connect_vert_pair(bm, verts, verts_exclude, faces_exclude)

Connect Verts.

Split faces by adding edges that connect verts.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.extrude_face_region(bm, geom, edges_exclude, use_keep_orig, use_normal_flip, use_normal_from_adjacent, use_select_history)

Extrude Faces.

Extrude operator (does not transform)

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • geom (list of (bmesh.types.BMVert, bmesh.types.BMEdge, bmesh.types.BMFace)) – edges and faces

  • edges_exclude (set of vert/edge/face type) – Undocumented.

  • use_keep_orig (bool) – keep original geometry (requires geom to include edges).

  • use_normal_flip (bool) – Create faces with reversed direction.

  • use_normal_from_adjacent (bool) – Use winding from surrounding faces instead of this region.

  • use_select_history (bool) – pass to duplicate

Returns

Return type

dict with string keys

bmesh.ops.dissolve_verts(bm, verts, use_face_split, use_boundary_tear)

Dissolve Verts.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • verts (list of (bmesh.types.BMVert)) – Undocumented.

  • use_face_split (bool) – Undocumented.

  • use_boundary_tear (bool) – Undocumented.

bmesh.ops.dissolve_edges(bm, edges, use_verts, use_face_split)

Dissolve Edges.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – Undocumented.

  • use_verts (bool) – dissolve verts left between only 2 edges.

  • use_face_split (bool) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.dissolve_faces(bm, faces, use_verts)

Dissolve Faces.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.dissolve_limit(bm, angle_limit, use_dissolve_boundaries, verts, edges, delimit)

Limited Dissolve.

Dissolve planar faces and co-linear edges.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • angle_limit (float) – total rotation angle (radians)

  • use_dissolve_boundaries (bool) – Undocumented.

  • verts (list of (bmesh.types.BMVert)) – Undocumented.

  • edges (list of (bmesh.types.BMEdge)) – Undocumented.

  • delimit (set of flags from ['NORMAL', 'MATERIAL', 'SEAM', 'SHARP', 'UV'], default {}) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.dissolve_degenerate(bm, dist, edges)

Degenerate Dissolve.

Dissolve edges with no length, faces with no area.

Parameters
bmesh.ops.triangulate(bm, faces, quad_method, ngon_method)

Triangulate.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – Undocumented.

  • quad_method (enum in ['BEAUTY', 'FIXED', 'ALTERNATE', 'SHORT_EDGE'], default 'BEAUTY') – Undocumented.

  • ngon_method (enum in ['BEAUTY', 'EAR_CLIP'], default 'BEAUTY') – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.unsubdivide(bm, verts, iterations)

Un-Subdivide.

Reduce detail in geometry containing grids.

Parameters
bmesh.ops.subdivide_edges(bm, edges, smooth, smooth_falloff, fractal, along_normal, cuts, seed, custom_patterns, edge_percents, quad_corner_type, use_grid_fill, use_single_edge, use_only_quads, use_sphere, use_smooth_even)

Subdivide Edges.

Advanced operator for subdividing edges with options for face patterns, smoothing and randomization.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – Undocumented.

  • smooth (float) – Undocumented.

  • smooth_falloff (enum in ['SMOOTH', 'SPHERE', 'ROOT', 'SHARP', 'LINEAR', 'INVERSE_SQUARE'], default 'SMOOTH') – smooth falloff type

  • fractal (float) – Undocumented.

  • along_normal (float) – Undocumented.

  • cuts (int) – Undocumented.

  • seed (int) – Undocumented.

  • custom_patterns (dict mapping vert/edge/face types to unknown internal data, not compatible with python) – uses custom pointers

  • edge_percents (dict mapping vert/edge/face types to float) – Undocumented.

  • quad_corner_type (enum in ['STRAIGHT_CUT', 'INNER_VERT', 'PATH', 'FAN'], default 'STRAIGHT_CUT') – quad corner type

  • use_grid_fill (bool) – fill in fully-selected faces with a grid

  • use_single_edge (bool) – tessellate the case of one edge selected in a quad or triangle

  • use_only_quads (bool) – only subdivide quads (for loopcut)

  • use_sphere (bool) – for making new primitives only

  • use_smooth_even (bool) – maintain even offset when smoothing

Returns

Return type

dict with string keys

bmesh.ops.subdivide_edgering(bm, edges, interp_mode, smooth, cuts, profile_shape, profile_shape_factor)

Subdivide Edge-Ring.

Take an edge-ring, and subdivide with interpolation options.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input vertices

  • interp_mode (enum in ['LINEAR', 'PATH', 'SURFACE'], default 'LINEAR') – interpolation method

  • smooth (float) – Undocumented.

  • cuts (int) – Undocumented.

  • profile_shape (enum in ['SMOOTH', 'SPHERE', 'ROOT', 'SHARP', 'LINEAR', 'INVERSE_SQUARE'], default 'SMOOTH') – profile shape type

  • profile_shape_factor (float) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.bisect_plane(bm, geom, dist, plane_co, plane_no, use_snap_center, clear_outer, clear_inner)

Bisect Plane.

Bisects the mesh by a plane (cut the mesh in half).

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • geom (list of (bmesh.types.BMVert, bmesh.types.BMEdge, bmesh.types.BMFace)) – Undocumented.

  • dist (float) – minimum distance when testing if a vert is exactly on the plane

  • plane_co (mathutils.Vector or any sequence of 3 floats) – point on the plane

  • plane_no (mathutils.Vector or any sequence of 3 floats) – direction of the plane

  • use_snap_center (bool) – snap axis aligned verts to the center

  • clear_outer (bool) – when enabled. remove all geometry on the positive side of the plane

  • clear_inner (bool) – when enabled. remove all geometry on the negative side of the plane

Returns

Return type

dict with string keys

bmesh.ops.delete(bm, geom, context)

Delete Geometry.

Utility operator to delete geometry.

Parameters
bmesh.ops.duplicate(bm, geom, dest, use_select_history, use_edge_flip_from_face)

Duplicate Geometry.

Utility operator to duplicate geometry, optionally into a destination mesh.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.split(bm, geom, dest, use_only_faces)

Split Off Geometry.

Disconnect geometry from adjacent edges and faces, optionally into a destination mesh.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.spin(bm, geom, cent, axis, dvec, angle, space, steps, use_merge, use_normal_flip, use_duplicate)

Spin.

Extrude or duplicate geometry a number of times, rotating and possibly translating after each step

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • geom (list of (bmesh.types.BMVert, bmesh.types.BMEdge, bmesh.types.BMFace)) – Undocumented.

  • cent (mathutils.Vector or any sequence of 3 floats) – rotation center

  • axis (mathutils.Vector or any sequence of 3 floats) – rotation axis

  • dvec (mathutils.Vector or any sequence of 3 floats) – translation delta per step

  • angle (float) – total rotation angle (radians)

  • space (mathutils.Matrix) – matrix to define the space (typically object matrix)

  • steps (int) – number of steps

  • use_merge (bool) – Merge first/last when the angle is a full revolution.

  • use_normal_flip (bool) – Create faces with reversed direction.

  • use_duplicate (bool) – duplicate or extrude?

Returns

Return type

dict with string keys

bmesh.ops.rotate_uvs(bm, faces, use_ccw)

UV Rotation.

Cycle the loop UV’s

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • use_ccw (bool) – rotate counter-clockwise if true, otherwise clockwise

bmesh.ops.reverse_uvs(bm, faces)

UV Reverse.

Reverse the UV’s

Parameters
bmesh.ops.rotate_colors(bm, faces, use_ccw)

Color Rotation.

Cycle the loop colors

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • use_ccw (bool) – rotate counter-clockwise if true, otherwise clockwise

bmesh.ops.reverse_colors(bm, faces)

Color Reverse

Reverse the loop colors.

Parameters
bmesh.ops.split_edges(bm, edges, verts, use_verts)

Edge Split.

Disconnects faces along input edges.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • verts (list of (bmesh.types.BMVert)) – optional tag verts, use to have greater control of splits

  • use_verts (bool) – use ‘verts’ for splitting, else just find verts to split from edges

Returns

Return type

dict with string keys

bmesh.ops.create_grid(bm, x_segments, y_segments, size, matrix, calc_uvs)

Create Grid.

Creates a grid with a variable number of subdivisions

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • x_segments (int) – number of x segments

  • y_segments (int) – number of y segments

  • size (float) – size of the grid

  • matrix (mathutils.Matrix) – matrix to multiply the new geometry with

  • calc_uvs (bool) – calculate default UVs

Returns

Return type

dict with string keys

bmesh.ops.create_uvsphere(bm, u_segments, v_segments, diameter, matrix, calc_uvs)

Create UV Sphere.

Creates a grid with a variable number of subdivisions

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • u_segments (int) – number of u segments

  • v_segments (int) – number of v segment

  • diameter (float) – diameter

  • matrix (mathutils.Matrix) – matrix to multiply the new geometry with

  • calc_uvs (bool) – calculate default UVs

Returns

Return type

dict with string keys

bmesh.ops.create_icosphere(bm, subdivisions, diameter, matrix, calc_uvs)

Create Ico-Sphere.

Creates a grid with a variable number of subdivisions

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • subdivisions (int) – how many times to recursively subdivide the sphere

  • diameter (float) – diameter

  • matrix (mathutils.Matrix) – matrix to multiply the new geometry with

  • calc_uvs (bool) – calculate default UVs

Returns

Return type

dict with string keys

bmesh.ops.create_monkey(bm, matrix, calc_uvs)

Create Suzanne.

Creates a monkey (standard blender primitive).

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • matrix (mathutils.Matrix) – matrix to multiply the new geometry with

  • calc_uvs (bool) – calculate default UVs

Returns

Return type

dict with string keys

bmesh.ops.create_cone(bm, cap_ends, cap_tris, segments, diameter1, diameter2, depth, matrix, calc_uvs)

Create Cone.

Creates a cone with variable depth at both ends

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • cap_ends (bool) – whether or not to fill in the ends with faces

  • cap_tris (bool) – fill ends with triangles instead of ngons

  • segments (int) – Undocumented.

  • diameter1 (float) – diameter of one end

  • diameter2 (float) – diameter of the opposite

  • depth (float) – distance between ends

  • matrix (mathutils.Matrix) – matrix to multiply the new geometry with

  • calc_uvs (bool) – calculate default UVs

Returns

Return type

dict with string keys

bmesh.ops.create_circle(bm, cap_ends, cap_tris, segments, radius, matrix, calc_uvs)

Creates a Circle.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • cap_ends (bool) – whether or not to fill in the ends with faces

  • cap_tris (bool) – fill ends with triangles instead of ngons

  • segments (int) – Undocumented.

  • radius (float) – Radius of the circle.

  • matrix (mathutils.Matrix) – matrix to multiply the new geometry with

  • calc_uvs (bool) – calculate default UVs

Returns

Return type

dict with string keys

bmesh.ops.create_cube(bm, size, matrix, calc_uvs)

Create Cube

Creates a cube.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • size (float) – size of the cube

  • matrix (mathutils.Matrix) – matrix to multiply the new geometry with

  • calc_uvs (bool) – calculate default UVs

Returns

Return type

dict with string keys

bmesh.ops.bevel(bm, geom, offset, offset_type, segments, profile, vertex_only, clamp_overlap, material, loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode, miter_outer, miter_inner, spread, smoothresh, use_custom_profile, custom_profile, vmesh_method)

Bevel.

Bevels edges and vertices

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • geom (list of (bmesh.types.BMVert, bmesh.types.BMEdge, bmesh.types.BMFace)) – input edges and vertices

  • offset (float) – amount to offset beveled edge

  • offset_type (enum in ['OFFSET', 'WIDTH', 'DEPTH', 'PERCENT'], default 'OFFSET') – how to measure the offset

  • segments (int) – number of segments in bevel

  • profile (float) – profile shape, 0->1 (.5=>round)

  • vertex_only (bool) – only bevel vertices, not edges

  • clamp_overlap (bool) – do not allow beveled edges/vertices to overlap each other

  • material (int) – material for bevel faces, -1 means get from adjacent faces

  • loop_slide (bool) – prefer to slide along edges to having even widths

  • mark_seam (bool) – extend edge data to allow seams to run across bevels

  • mark_sharp (bool) – extend edge data to allow sharp edges to run across bevels

  • harden_normals (bool) – harden normals

  • face_strength_mode (enum in ['NONE', 'NEW', 'AFFECTED', 'ALL'], default 'NONE') – whether to set face strength, and which faces to set if so

  • miter_outer (enum in ['SHARP', 'PATCH', 'ARC'], default 'SHARP') – outer miter kind

  • miter_inner (enum in ['SHARP', 'PATCH', 'ARC'], default 'SHARP') – outer miter kind

  • spread (float) – amount to offset beveled edge

  • smoothresh (float) – for passing mesh’s smoothresh, used in hardening

  • use_custom_profile (bool) – Whether to use custom profile feature

  • custom_profile (bpy.types.bpy_struct) – Undocumented.

  • vmesh_method (enum in ['ADJ', 'CUTOFF'], default 'ADJ') – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.beautify_fill(bm, faces, edges, use_restrict_tag, method)

Beautify Fill.

Rotate edges to create more evenly spaced triangles.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • edges (list of (bmesh.types.BMEdge)) – edges that can be flipped

  • use_restrict_tag (bool) – restrict edge rotation to mixed tagged vertices

  • method (enum in ['AREA', 'ANGLE'], default 'AREA') – method to define what is beautiful

Returns

Return type

dict with string keys

bmesh.ops.triangle_fill(bm, use_beauty, use_dissolve, edges, normal)

Triangle Fill.

Fill edges with triangles

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • use_beauty (bool) – Undocumented.

  • use_dissolve (bool) – dissolve resulting faces

  • edges (list of (bmesh.types.BMEdge)) – input edges

  • normal (mathutils.Vector or any sequence of 3 floats) – optionally pass the fill normal to use

Returns

Return type

dict with string keys

bmesh.ops.solidify(bm, geom, thickness)

Solidify.

Turns a mesh into a shell with thickness

Parameters
Returns

Return type

dict with string keys

bmesh.ops.inset_individual(bm, faces, thickness, depth, use_even_offset, use_interpolate, use_relative_offset)

Face Inset (Individual).

Insets individual faces.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • thickness (float) – Undocumented.

  • depth (float) – Undocumented.

  • use_even_offset (bool) – Undocumented.

  • use_interpolate (bool) – Undocumented.

  • use_relative_offset (bool) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.inset_region(bm, faces, faces_exclude, use_boundary, use_even_offset, use_interpolate, use_relative_offset, use_edge_rail, thickness, depth, use_outset)

Face Inset (Regions).

Inset or outset face regions.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • faces_exclude (list of (bmesh.types.BMFace)) – Undocumented.

  • use_boundary (bool) – Undocumented.

  • use_even_offset (bool) – Undocumented.

  • use_interpolate (bool) – Undocumented.

  • use_relative_offset (bool) – Undocumented.

  • use_edge_rail (bool) – Undocumented.

  • thickness (float) – Undocumented.

  • depth (float) – Undocumented.

  • use_outset (bool) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.offset_edgeloops(bm, edges, use_cap_endpoint)

Edgeloop Offset.

Creates edge loops based on simple edge-outset method.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.wireframe(bm, faces, thickness, offset, use_replace, use_boundary, use_even_offset, use_crease, crease_weight, use_relative_offset, material_offset)

Wire Frame.

Makes a wire-frame copy of faces.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • thickness (float) – Undocumented.

  • offset (float) – Undocumented.

  • use_replace (bool) – Undocumented.

  • use_boundary (bool) – Undocumented.

  • use_even_offset (bool) – Undocumented.

  • use_crease (bool) – Undocumented.

  • crease_weight (float) – Undocumented.

  • use_relative_offset (bool) – Undocumented.

  • material_offset (int) – Undocumented.

Returns

Return type

dict with string keys

bmesh.ops.poke(bm, faces, offset, center_mode, use_relative_offset)

Pokes a face.

Splits a face into a triangle fan.

Parameters
  • bm (bmesh.types.BMesh) – The bmesh to operate on.

  • faces (list of (bmesh.types.BMFace)) – input faces

  • offset (float) – center vertex offset along normal

  • center_mode (enum in ['MEAN_WEIGHTED', 'MEAN', 'BOUNDS'], default 'MEAN_WEIGHTED') – calculation mode for center vertex

  • use_relative_offset (bool) – apply offset

Returns

Return type

dict with string keys

bmesh.ops.convex_hull(bm, input, use_existing_faces)

Convex Hull

Builds a convex hull from the vertices in ‘input’.

If ‘use_existing_faces’ is true, the hull will not output triangles that are covered by a pre-existing face.

All hull vertices, faces, and edges are added to ‘geom.out’. Any input elements that end up inside the hull (i.e. are not used by an output face) are added to the ‘interior_geom’ slot. The ‘unused_geom’ slot will contain all interior geometry that is completely unused. Lastly, ‘holes_geom’ contains edges and faces that were in the input and are part of the hull.

Parameters
Returns

Return type

dict with string keys

bmesh.ops.symmetrize(bm, input, direction, dist)

Symmetrize.

Makes the mesh elements in the “input” slot symmetrical. Unlike normal mirroring, it only copies in one direction, as specified by the “direction” slot. The edges and faces that cross the plane of symmetry are split as needed to enforce symmetry.

All new vertices, edges, and faces are added to the “geom.out” slot.

Parameters
Returns

Return type

dict with string keys