1
$\begingroup$

I'm struggling finding a way to fix an issue, that seemingly seems trivial, but for which I still don't have any answer.

angle

I'd like to change the angle (make it 90°) between the two selected faces as shown below. How can I do that?

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

Bmesh script

enter image description here

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
from math import radians, degrees
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:
    for f in e.link_faces:
        if f.select and f is not f0:
            axis = (e.verts[1].co - e.verts[0].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[0].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.

$\endgroup$
0
$\begingroup$

Select a vertex with the correct X location.

Copy the X value from the Transform panel, n to open/close enter image description here

Select the two vertices you need to align enter image description here

Paste to X value enter image description here

instant 90 degree angle.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.