Skip to content

Instantly share code, notes, and snippets.

@CGArtPython
Created August 28, 2023 07:15
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/cd177a97bd5a8ba13e46dd5375af1b57 to your computer and use it in GitHub Desktop.
Save CGArtPython/cd177a97bd5a8ba13e46dd5375af1b57 to your computer and use it in GitHub Desktop.
Blender Python script that bevels the edges of an active object that is in EDIT mode (see tutorial here: https://youtu.be/TFQMNcTj5Jw)
import bpy
import bmesh
# get a reference to the active object
mesh_obj = bpy.context.active_object
# create a new bmesh and initialize it from mesh data in Edit Mode
bm = bmesh.from_edit_mesh(mesh_obj.data)
bmesh.ops.bevel(
bm,
geom=bm.edges,
offset=0.2,
segments=4,
affect="EDGES",
profile=0.5,
)
bm.normal_update()
# writes the bmesh data into the mesh data in Edit Mode
bmesh.update_edit_mesh(mesh_obj.data)
# clean up/free memory that was allocated for the bmesh
bm.free()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment