has been shut down on the 6th of March 2021. You can read a bit more about it here.

You are currently reading an archived copy of the latest content, with all the usernames deleted.

Get center point of a edge loop selection

by user9 posted 02-11-2017 | 5 comments

How to get a center point of the selected edge loop ?



by user92 posted 30-11-2017

you guys are super smart, here is my dirty way of doing it, you must select the edge loop as well,


by user29 posted 08-11-2017

Hi Denilson, reading a bit in PyMel, I found this solution with MeshEdge getPoint

import pymel.core as pm

def locatorMedian():
    given an edge(s) selection, creates a locator in the median position

    x_pos_list = []; y_pos_list = []; z_pos_list = []
    oSel = pm.selected(flatten=True)

    for edge in oSel:
        xVertex = edge.getPoint(0, space='world')

        yVertex = edge.getPoint(0, space='world')

        zVertex = edge.getPoint(0, space='world')

    xPos = sum(x_pos_list)/len(x_pos_list)
    yPos = sum(y_pos_list)/len(y_pos_list)
    zPos = sum(z_pos_list)/len(z_pos_list)

    pm.spaceLocator(p=(xPos, yPos, zPos))



by user7 posted 02-11-2017

hi denilson,

I found a quick way to find what you are asking for, the only problem is that you have to select edge loops before running the code.

hope this helps. cheers


by user3 posted 02-11-2017

Oh, that's a really clever way to do it! I wouldn't have thought to take it from the manipulator.

Here's what I've been doing.

import maya.cmds as mc

boundingBox = mc.exactWorldBoundingBox(,fl=1))
boundingBoxMin = boundingBox[:3]
boundingBoxMax = boundingBox[-3:]
centre = [(boundingBoxMax[0] + boundingBoxMin[0])/2, (boundingBoxMax[1] + boundingBoxMin[1])/2, (boundingBoxMax[2] + boundingBoxMin[2])/2 ]


by user9 posted 02-11-2017

thanks, i will give it a shot. didn't know that I could retrieve the manipulator's position.