Page 1 of 1

"Feature request", ...

Posted: Sun Jan 27, 2013 10:59 pm
by brasshat
...because I don't see these capabilities in Blender native functionality, though I admit that it may just be that I don't know where to look, or are there plug ins that would achieve what I want to do?

1) I'd like to be able to select two vertices, and see the distance between them.

2) I'd also like to be able to select a set if three or more vertices, and have Blender align them with to the first two vertices selected. I'd also like to see this work on sets of vertices, so that I could select three or more sets of vertices, and have the sets aligned.


Posted: Mon Jan 28, 2013 8:35 am
by CoDEmanX
1.) here you go:

Code: Select all

import bpy, bmesh

class VIEW3D_OT_report_vert_distance(bpy.types.Operator):
    bl_idname = "view3d.report_vert_distance"
    bl_label = "Report Vertex Distance"

    def poll(cls, context):
        return (context.active_object is not None and
                context.active_object.type == 'MESH' and
                context.active_object.mode == 'EDIT'

    def execute(self, context):
        me =
        bm = bmesh.from_edit_mesh(me)
        sel_verts = [v for v in bm.verts if]
        if len(sel_verts) != 2:
  {'WARNING'}, "Need 2 selected vertices!")
            return {'CANCELLED'}
        dist = (sel_verts[1].co - sel_verts[0].co).length
       {'INFO'}, "Distance: %.02f" % dist)
        return {'FINISHED'}

def register():

def unregister():

if __name__ == "__main__":
2.) Did you try the LoopTools addon, it has a flatten feature?

Posted: Mon Jan 28, 2013 11:03 am
by brasshat
I'm most appreciative of your efforts in providing the code, CoDEmanX, but I must confess that I lack the necessary knowledge and skills to add it to my installation of Blender, and I also would like to think that I'm not the only one who would find it of value, and that it might be considered for inclusion in future versions.

As to using the loop tools to accomplish my second request, I not sure I understand how using the loop tools add-on flatten feature would work in the situations for which I'm looking for the ability to align mesh elements.


Posted: Mon Jan 28, 2013 1:16 pm
by CoDEmanX
there's deffo an addon for aligning things like you want it, and i believe looptools support it. But might be a different addon.

vert distance: i don't think that addon is any useful, the actual code is a single liner and it doesn't do anything else. Plus there might already be a better measure addon (i'm pretty sure there is...)

copy the code to a new text file and save as "", then install addon with blender (easier than locating the copying to the addon folder). Then enable testing category in user prefs > addons, search for "report" or "distance" and enable the addon. In 3d View, hit space bar and type that phrase again to run it.