# How to change angle between two faces of an object?

I'm struggling finding a way to fix an issue, that seemingly seems trivial, but for which I still don't have any answer. I'd like to change the angle (make it 90°) between the two selected faces as shown below. How can I do that?

In Edit mode, on the bottom horizontal menu bar, select the Vertex as Snap Element mode (next to the Snap tool button), but no need to enable the Snap tool, select the vertices you want to move, press X to move them only along the X axis, keep pressing ctrl to temporarily enable the Snap option, drag your mouse to one of the vertices of the other edge, the vertices you've selected will move on the X axis and snap to the same position of the X axis than the other vertices.

Bmesh script Rotate each selected face about its common edge with the active face, such that its new normal is a right angle. The axis of revolution is the edge. The new normal will be, one of the two vectors, +/- the cross product with the axis.

There is a choice whether to fold the face in or out to obtain the required face angle. The dot product is used to choose which. The rotational difference quaternion between the old normal and new vectors is applied as a matrix to the vertices of the folding faces.

The active face remains in place.

import bpy
import bmesh
from mathutils import Vector, Matrix
context = bpy.context
ob = context.edit_object
me = ob.data

bm = bmesh.from_edit_mesh(me)
f0 = bm.select_history.active
n = f0.normal

for e in f0.edges:
if f.select and f is not f0:
axis = (e.verts.co - e.verts.co).normalized()
new_normal = axis.cross(n)
# not sure on this test, any suggestions much appreciated
if f.normal.dot(-new_normal) > f.normal.dot(new_normal):
new_normal *= -1
R = (f.normal).rotation_difference(new_normal).to_matrix()
bmesh.ops.rotate(bm,
cent=e.verts.co,
matrix=R,
verts=f.verts
)

bmesh.update_edit_mesh(me)


Notes

Could also use

new_normal = Matrix.Rotation(alpha, 3, axis) * n


which will allow for an arbitrary face angle alpha Using -alpha will give the matrix for the other possible normal.

Not sure on the test, re "whether to open door in or out 90 degrees" any suggestions most appreciated.

Select a vertex with the correct X location.

Copy the X value from the Transform panel, n to open/close Select the two vertices you need to align instant 90 degree angle.

• Worth noting this method relies on the alignment of the mesh to its local axes. A face on the UV sphere for example Nov 7 '18 at 13:06