Determining the length of an edge ring

CG Cookie

Stupid question, but can you display the entire length/radius of a ring? I can only find the option to display the individual sections. I have already tried something with MeasureIT but no succes. Thanks


1 love
Reply
  • Martin Bergwerf replied

    HI Leo,

    You could Select that Edge Loop,  P > Separate > Selection. Switch to Object Mode and Select the new Object and Add a little GN tree like this:

    Length.png

    If I remember correctly, Python also has access to the Length of Curves...

    2 loves
  • Leo (wod) replied

    Thank you Martin for your help. I thought there was a quick/direct solution that I overlooked but this definitely helps. Thank you 

    1 love
  • Martin Bergwerf replied

    ...come to think of it, if you're going to use Python, you could simply add all the Edge Lengths of the Selected Edges. That'll probably be faster than to first Convert them to a Curve.

    2 loves
  • Martin Bergwerf replied

    Maybe there already exists an Addon that does something like that...I don't know.


    2 loves
  • Martin Bergwerf replied

    And there is this old post, that says you can use MeasureIt for that: https://blender.stackexchange.com/questions/1674/how-to-get-selected-edges-length


    2 loves
  • Sascha Feider(SFE-Viz) replied

    If you want the radius of a ring like that you can use the MeasureIt extension:

    You'll have to go into vertex mode and select three vertices on the ring you want to measure and then in the extension (under view in the n-panel) click on "Arc". It will the show the radius, length and angle of the arc. Make sure you click on "show" in the extension, otherwise you won't see anything.

    screen.png

    2 loves
  • Dwayne Savage(dillenbata3) replied

    If you want to go the python route:

    import bpy
    # Get the active object
    obj = bpy.context.active_object # Check if the object is a mesh if obj.type == 'MESH':     # Enter edit mode     bpy.ops.object.mode_set(mode='EDIT')     total_length = 0     # Get the selected edges     edges = [e for e in obj.data.edges if e.select]     # Calculate the length of each selected edge     for edge in edges:         v1 = obj.data.vertices[edge.vertices[0]].co         v2 = obj.data.vertices[edge.vertices[1]].co         length = (v2 - v1).length         #add the edge lengths together         total_length = total_length+length     #Print the total length to the console     print(f"Total length: {total_length}")

    This will output the total length of selected edges. I don't know why but for some reason you have to go to object mode and back into edit mode for blender to detect the change to the selected edges. It's probably because of my method of determining selected edges. It's the only thing I could come up with. So, I added a mode set to edit. This way you can just select your edges tab to object mode and run the script. Now that I'm typing this I could have just switched to object mode instead. I think. 

    bpy.ops.object.mode_set(mode='OBJECT')

    I haven't tested that. The script does work in object mode. For windows user to access the console click windows->Toggle System Console. For Linux user you can add "-con" without the quotes after running ./blender in the terminal or if you have a menu item or desktop icon you can check run in terminal for the launchers properties. Sorry, Mac people I don't know on Mac, but I do know you can use the -con in terminal mode. 

    ***Edit*** It works. So here is the change so you don't have to tab to object mode.

    import bpy
    # Get the active object obj = bpy.context.active_object # Check if the object is a mesh if obj.type == 'MESH':     # Enter edit mode     bpy.ops.object.mode_set(mode='OBJECT')     bpy.ops.object.mode_set(mode='EDIT')     total_length = 0     # Get the selected edges     edges = [e for e in obj.data.edges if e.select]     # Calculate the length of each selected edge     for edge in edges:         v1 = obj.data.vertices[edge.vertices[0]].co         v2 = obj.data.vertices[edge.vertices[1]].co         length = (v2 - v1).length         #add the edge lengths together         total_length = total_length+length     #Print the total length to the console     print(f"Total length: {total_length}")

    1 love
  • Leo (wod) replied

    Thanks for all the help and feedback. You are the best

    • 👍
    2 loves