lock edge length - editmode? I want to block the edge length even if you are moving or rotating the edges in edit mode.

I did some research, but no one give a good answere.
link 1
link 2
link3
link 4

finally I tried to use a modal operator with event.type =='MOUSEMOVE', but this don't work if I'm using another operator.

THINGS THAT I KNOW

If I want to move the vertex A without changing the size from edges Ab, Ac and bc, the only way that I know is using a rotation operation.


BUT, in order to do that  I have  to change to Edges, select edge Ac and bc (in that specific order), after that change the pivot point to "active element"... in this case the edge bc, after that change the "transform orientation" to normal.... and after all I can not rotate in the right way!!



then I did a easy addon with some buttons that do the work

row = layout.row()
        props = row.operator("view3d.pivot_point_set", text="Pivote Elemento Activo", icon='STYLUS_PRESSURE')
        props.type="ACTIVE_ELEMENT"

        row = layout.row()
        props = row.operator("transform.rotate", text="Left Slow", icon='STYLUS_PRESSURE')
        props.value = 0.392699
        props.constraint_axis=(True, False, True)
        props.constraint_orientation = "NORMAL"

        props = row.operator("transform.rotate", text="Right Slow", icon='STYLUS_PRESSURE')
        props.value = -0.392699

        props.constraint_axis=(True, False, True)
        props.constraint_orientation = "NORMAL"


        row = layout.row()
        props = row.operator("transform.rotate", text="Left Total", icon='STYLUS_PRESSURE')
        props.value = 3.141599
        props.constraint_axis=(True, False, True)
        props.constraint_orientation = "NORMAL"

        props = row.operator("transform.rotate", text="Right Total", icon='STYLUS_PRESSURE')
        props.value = -3.141599
        props.constraint_axis=(True, False, True)
        props.constraint_orientation = "NORMAL"




but.... do you know some easy way as lock the edge length?

thanks

UPDATE 1

AFTER some research and apply some comments  I made some previos addon in order to apply hooks and constrains to "each" vertex that I want "look", and I get some interesting results:




the main problem is when you want lock more than 3 edges or vertex....... some ideas please?
Put together a bmesh "proof of concept" for this and haven't converted to operator.

It's not really locking edge length, rather finding the closest point on the edge from the vert, and rotating the vector made from that point to the vert, around the axis made by the edge.

To run the test code, in edit mode, vertex selection mode, select the 3 verts of the triangle ABC, with A selected last.  (thinking  using one selected vert that is part of a triangle face, and not a member of any other faces could be the way to go)

Run the script which adds a vertex to the "pivot point" calculated using mathutils.geometry.intersect_point_line(pt, line_p1, line_p2) then using the rotation matrix with edge as axis, adds a vert for the circular "fold" path, in 5 degree increments.

import bpy
import bmesh
from mathutils.geometry import intersect_point_line
from math import radians
from mathutils import Matrix

context = bpy.context
edit_object = context.edit_object
mesh = edit_object.data
bm = bmesh.from_edit_mesh(mesh)

# 3 verts selected in vert mode
e0, e1, v  = bm.select_history

# pivot point

pivot_point, pc = intersect_point_line(v.co, e0.co, e1.co)
bm.verts.new(pivot_point)

radius = v.co - pivot_point
for i in range(72):

    rotmat = Matrix.Rotation(radians(i*5), 3, (e1.co - e0.co))
    bm.verts.new(pivot_point + rotmat * radius)

bmesh.update_edit_mesh(mesh)




For the operator, which would move the vert by the rotation rather than displaying path,  would need a decision on how to choose vert / edge and setting the vert coord to the rotation, whether to make it modal, give it shortcuts etc.

Example operator here https://gist.github.com/batFINGER/dec833554fd7682bcf6621760389ab7a