Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

May 16, 2011

Blender 2.5 Python Extrude with Vector

import bpy
from mathutils import Vector

myVec = Vector((1.0,2.0,1.0))

bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, 
                                 TRANSFORM_OT_translate={"value":myVec})
If you execute this script while in edit mode, with a face selected (in face selection mode) -- then the created faces along the extrusion will/may appear inverted, they revert to outside as soon as you perform other operations on a mesh. Experiment!

The 2.6 equivalent code

The best way to figure these things out is to use the reporting console, (ie, set for example a timeline window to display the information window, any user interaction will show up as code)

3 comments:

  1. Replies
    1. I get:
      TypeError: Converting py args to operator properties: enum "REGION" not found in ()

      Delete
    2. this was written for blender 2.5 and indeed doesn't seem to work any more in 2.6. Check back later for an update. (or figure it out by using the reporting console)

      Delete

Please use Blender.StackExchange.com for python scripting questions unrelated to this post.