Skip to content

Instantly share code, notes, and snippets.

@CGArtPython
Created April 22, 2023 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CGArtPython/bc10b8a9b6e4934458bb664d8f45f1e1 to your computer and use it in GitHub Desktop.
Save CGArtPython/bc10b8a9b6e4934458bb664d8f45f1e1 to your computer and use it in GitHub Desktop.
Beginner Blender Python tutorial code for beveling a single edge
import bpy
import bmesh
bpy.ops.mesh.primitive_cube_add()
cube_obj = bpy.context.active_object
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action="DESELECT")
bm = bmesh.from_edit_mesh(cube_obj.data)
# make sure we can use the [] square brackets to retrieve edges
bm.edges.ensure_lookup_table()
# get reference to an edge and select it
edge = bm.edges[0]
edge.select = True
bpy.ops.mesh.bevel(offset=0.5, segments=8, affect="EDGES")
bpy.ops.object.editmode_toggle()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment