1

How do you get the name of a piece of geo when all you have is a component of that geo (uvs, faces, verts, edges)?

so for example I have:

MeshVertex(u'pCubeShape1.vtx[0]') #replace that with any of the following (uvs, faces, edges)

and what I would like to end up with is:

nt.Transform(u'pCube1')

How can I do this?

Bleeding Fingers
  • 6,993
  • 7
  • 46
  • 74
TheBeardedBerry
  • 1,636
  • 5
  • 20
  • 30
  • You can do this both with [**cmds.ls**](http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/ls.html) (if I'm not terribly mistaken with geometry flag, no Maya at hand) and with [**cmds.listRelatives**](http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/listRelatives.html) – joojaa Nov 11 '13 at 08:53
  • @joojaa just tested and neither seems to be working. – Bleeding Fingers Nov 11 '13 at 12:11
  • Ah sorry you were using pymel – joojaa Nov 11 '13 at 20:57
  • @TheBeardedBerry if by geo you mean geometry then please edit the question replacing geo with geometry. – Bleeding Fingers Nov 12 '13 at 18:04

2 Answers2

1

Say vtx = MeshVertex(u'pCubeShape1.vtx[0]')

then the transform/geo can be found using:

import pymel.core as pc
transforms = pc.listTransforms(vtx.node())
transform = transforms[0] #in case there is only one.
Bleeding Fingers
  • 6,993
  • 7
  • 46
  • 74
1

As your example, let's say v = MeshVertex(u'pCubeShape1.vtx[0]')

import pymel.core as pm
transform = v.node().getParent()
select(transform)

I know this question has already been answered, but I thought I'd post my way of doing this so that others can see different ways :)

Hope this helps

Shannon Hochkins
  • 11,763
  • 15
  • 62
  • 95