Created
August 28, 2023 07:16
-
-
Save CGArtPython/3fcc2878e3d3c528f11e2567f6ea2a67 to your computer and use it in GitHub Desktop.
Blender Python script that bevels the edges of an active object that is in OBJECT mode (see tutorial here: https://youtu.be/TFQMNcTj5Jw)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import bmesh | |
# get a reference to the active object | |
mesh_obj = bpy.context.active_object | |
# create a new bmesh | |
bm = bmesh.new() | |
# initialize the bmesh data using the mesh data | |
bm.from_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 | |
bm.to_mesh(mesh_obj.data) | |
# [Optional] update the mesh data (helps with redrawing the mesh in the viewport) | |
mesh_obj.data.update() | |
# 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