# 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?

• This is a really good thing for devs to add Dec 7 '16 at 1:43
• In one of your links, or another answer, I like the idea of 3 hooks at A, B, and C, with limit location constraints on A, to B & C. The locus "should" only let you move in desired rotation path. Dec 9 '16 at 14:53
• So you made an addon to do this, but want to know if there is an easier way built in to Blender? Dec 9 '16 at 16:11
• @batFINGER thanks to you comment I made some great update, please check the thread. Dec 11 '16 at 1:09
• @X-27 yes, I want that. some ideas to get this? Dec 11 '16 at 1:10

## 2 Answers

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

• thanks again. I check this solution and is great only for 3 vertex or edges... If I select more "weird" things happend :(, please check the update. thanks again Dec 11 '16 at 1:13
• @yhoyo The example operator only "folds" selected edge verts (a vert only in one triangle face) around the opposite edge. Unfortunately haven't determined whether rot will be clock or counter-clockwise. The op could be easilly modified to rotate all selected verts around an edge. I've seen the UPDATE and not sure about pulling verts from hooks in edit mode, and how that would work... as I commented was more looking at moving the constrained hook. Dec 15 '16 at 14:38

You can do what you're saying with the current tools and a different workflow.

• Create a new Transformation Orientation once the edge is selected and active it. This creates an axis where the "Y" direction is co-linear w/ your edge.
• Move the 3D cursor the the select edge (puts it in the middle of the edge by default). Move this (either with constuction type geometry or other selections) to where you exactly want it. Be sure to set your pivot point to the 3d cursor.
• Rotate your point around the Y axis (of the new transform, R Y Y).

See the below gif for an example...

Edit:

To find the 'closest' point on that edge so that you can get a 'perfect' rotation, you can do the following:

1. Start off w/ the new transform from the edge being selected and the edge being selected.
2. bisect that edge and select the new vertex
3. extrude a line along the new transform "x" direction (press E,X,X)
4. extrude that edge out longer than where the corner vertex is
5. enable snap to vertex and move than line along the 'edge transform' so that it snaps to the corner (G,Y,Y)
6. rotate the corner as above w/ the cursor
• his, thanks for try.. But this is worse; If solametne had to modify 1 time, fantastic !, but if I have to do it once again (a sequence) becomes unmanageable, in addition to the "axes" are fixed and do not change as you move, ... also happens the same That I said before, we do a thousand steps!. thanks for try :D Dec 8 '16 at 19:41
• I decide award you the bounnty because this is the close answer that I'm looking for in editmode... I hope this will be solved better in the future for blender's developers. thanks for answer. Dec 14 '16 at 2:01