For each edge in (selected edge loop) merge at individual center ??

well this what i want
For each edge in (selected edge loop) merge on individual center.
Any idea on how to do it, i think this can be very usefull also to others

( But i have no clue on how to do it, i want to use this to reduce my polycount )

Are you sure it’s what you want ? As far as I understand your algorithm, it will reduce all of your edge loop in just one point : as the current edge is merged in one point, this point will become one of the extremity of the next edge, which will become the current edge to merge and so on until there is no edge left. Is this correct ?

Sorry i made an error in the title and discription i wanted this for an Edge ring not for an Edge loop.
With an edge ring one could colaps just the ring but leave the rest intact

Edit it then (Edit / Go Advanced). No need to clutter up the forum by creating a new thread

I’m not sure it’s the most elegant way but this script should do the trick (with your object in edit mode and the edge ring selected) :


import bpy, bmesh


b = bmesh.from_edit_mesh(bpy.context.active_object.data)


edges = [e for e in b.edges if e.select]


bpy.ops.mesh.select_all(action='DESELECT')


for e in edges:
    e.select = True
    bpy.ops.mesh.merge(type='COLLAPSE')

The script works … GREAT SUPER !!!

Wouldnt this be a nice addition to mesh editing in general when we are in edit mode ?
I wonder if we could atach a shortcut letter to it, or a button on the screen

Does X -> Edge Collapse from the menu not do what you want?

No it doesnt, this script can do something else
Imagine you have a high poly model of a human, or something else which is to much high poly.
Or perhaps something that was 3D scanned
Now you want to lower the poly count, to get more optimal shape for in games or so.
You can select MULTIPLE edges manually or at once using Select edge ring
And have the colapse on a per edge basis

It works super with edge rings on objects.
You can quickly select like 40 edges or so, run the script and each individual one colapses
And not like colapsing to the whole groups centre point.
So this is much faster then using the ingle edge based menu on a per edge basis

The script can error in case selected edges are connected.
Maybe the for next needs an on error resume or so.

Also after the script has run, and your not satisfied with the outcome , just press ctrl+alt Z and you can try a differ edge based edge ring or manual selection

Note also that on high poly smooth models, the colapse has the effect of going to average center, and thus model impact is not too bad either, you can much faster decide if the model is OK or not and then reverse the action and try another selection

I guess I am not understanding the difference between bpy.ops.mesh.edge_collapse() which runs through the menu and bpy.ops.mesh.merge(type=‘COLLAPSE’) from the script. From testing both methods appear to produce the same results except in cases where the script fails, running from the menu will still produce a result but it will be messy.

Edit: never mind, some further testing shows that there is a practical difference and the script behaves more gracefully in the failure scenarios.

Another Edit: never mind again, there is some good introductory material in the table of contents at

http://www.blender.org/documentation/blender_python_api_2_68_release/

I will have to do some reading :slight_smile: