I’m trying to create a custom Inset tool for blender using scale and extrude functions under bpy.
Is there a better way to do this?
My problem is not being able to pass a single translate value to bpy.ops.mesh.extrude_mesh_region_move. What I want to do is be able to move the extrusion along the normal a specified amount. Is this possible and if so how?
You need to calculate the right value tuple first, which needs to be based on the interpolated face normals:
import bpy
from mathutils import Vector
ob = bpy.context.object
ob.update_from_editmode()
me = ob.data
normals = [poly.normal for poly in me.polygons if poly.select]
normal = sum(normals, Vector()) / len(normals)
value = 1.5
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={}, TRANSFORM_OT_translate={"value": normal * value})