# Using Local Transform Orientation for Vertex Rotations

I am creating a script to rotate a vertex selection in a very specific way. I have so far figured out how to set the pivot point to ACTIVE ELEMENT, following a hint from this thread on context overrides:

However, the transform.rotate command doesn't take into account whether the constraint_orientation is GLOBAL or LOCAL or any other. My Edit Mode vertex selection always rotates around Global axis.

I have also looked into transforming with object.matrix_world and mathutils.Matrix.Rotation but I'm not sure if this is going to work for vertex selections? It seems to be working only for Object, not Mesh Data?

Could anyone help me figure out how I can use Local or Custom Transformation as the constraint_orientation when rotating a Vertex Selection in Edit Mode, or whether there's another path to this. Thanks!

• For Local Transform I managed to get rotation to work by using transform.rotate where the axis parameter is axis=Vector(self.my_axis)*bpy.context.object.matrix_world.inverted(). However I am still looking for a way to get the Custom Transforms to work for rotations in Edit Mode. – z01ks Sep 9 '18 at 16:48
• If you are using operators, look at the constraint_orientation parameter to bpy.ops.transform.rotate. For bmesh.ops.rotate I think space is the matrix you want to set. – sambler Sep 10 '18 at 16:31