How do you select vertices in a maya python ls command?
up vote
0
down vote
favorite
When using maya's ls command when I'm selecting vertices and I want a list of the vertices I'm selecting, how can I use the type option so that I only get the vertices of a mesh?
Something like:
import pymel.core as pm
verts = pm.ls(sl=True, fl=True, type=[vertex? polymeshVtx?])
python maya
add a comment |
up vote
0
down vote
favorite
When using maya's ls command when I'm selecting vertices and I want a list of the vertices I'm selecting, how can I use the type option so that I only get the vertices of a mesh?
Something like:
import pymel.core as pm
verts = pm.ls(sl=True, fl=True, type=[vertex? polymeshVtx?])
python maya
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
When using maya's ls command when I'm selecting vertices and I want a list of the vertices I'm selecting, how can I use the type option so that I only get the vertices of a mesh?
Something like:
import pymel.core as pm
verts = pm.ls(sl=True, fl=True, type=[vertex? polymeshVtx?])
python maya
When using maya's ls command when I'm selecting vertices and I want a list of the vertices I'm selecting, how can I use the type option so that I only get the vertices of a mesh?
Something like:
import pymel.core as pm
verts = pm.ls(sl=True, fl=True, type=[vertex? polymeshVtx?])
python maya
python maya
asked Nov 22 at 15:53
Peteman
154
154
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Im giving you the method with maya.cmds
The second one could be a solution in pymel but there might be another easier method.
import maya.cmds as cmds
sel = cmds.ls(sl=True, o=True)[0]
sel_vtx = cmds.ls('{}.vtx[:]'.format(sel), fl=True)
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
vtx_nb = obj_sh._numVertices()
vtx_flatten = ['{}.vtx[{}]'.format(obj_sh,i) for i in vtx_nb]
--- EDIT ---
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
for v in obj_sh.vtx:
print(v)
The first one works well enough. Thanks!
– Peteman
Nov 22 at 23:31
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Im giving you the method with maya.cmds
The second one could be a solution in pymel but there might be another easier method.
import maya.cmds as cmds
sel = cmds.ls(sl=True, o=True)[0]
sel_vtx = cmds.ls('{}.vtx[:]'.format(sel), fl=True)
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
vtx_nb = obj_sh._numVertices()
vtx_flatten = ['{}.vtx[{}]'.format(obj_sh,i) for i in vtx_nb]
--- EDIT ---
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
for v in obj_sh.vtx:
print(v)
The first one works well enough. Thanks!
– Peteman
Nov 22 at 23:31
add a comment |
up vote
0
down vote
accepted
Im giving you the method with maya.cmds
The second one could be a solution in pymel but there might be another easier method.
import maya.cmds as cmds
sel = cmds.ls(sl=True, o=True)[0]
sel_vtx = cmds.ls('{}.vtx[:]'.format(sel), fl=True)
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
vtx_nb = obj_sh._numVertices()
vtx_flatten = ['{}.vtx[{}]'.format(obj_sh,i) for i in vtx_nb]
--- EDIT ---
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
for v in obj_sh.vtx:
print(v)
The first one works well enough. Thanks!
– Peteman
Nov 22 at 23:31
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Im giving you the method with maya.cmds
The second one could be a solution in pymel but there might be another easier method.
import maya.cmds as cmds
sel = cmds.ls(sl=True, o=True)[0]
sel_vtx = cmds.ls('{}.vtx[:]'.format(sel), fl=True)
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
vtx_nb = obj_sh._numVertices()
vtx_flatten = ['{}.vtx[{}]'.format(obj_sh,i) for i in vtx_nb]
--- EDIT ---
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
for v in obj_sh.vtx:
print(v)
Im giving you the method with maya.cmds
The second one could be a solution in pymel but there might be another easier method.
import maya.cmds as cmds
sel = cmds.ls(sl=True, o=True)[0]
sel_vtx = cmds.ls('{}.vtx[:]'.format(sel), fl=True)
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
vtx_nb = obj_sh._numVertices()
vtx_flatten = ['{}.vtx[{}]'.format(obj_sh,i) for i in vtx_nb]
--- EDIT ---
import pymel.core as pm
obj_sh = pm.ls(sl=True, dag=True, type='mesh')[0]
for v in obj_sh.vtx:
print(v)
edited Nov 22 at 17:48
answered Nov 22 at 17:28
DrWeeny
1,4321912
1,4321912
The first one works well enough. Thanks!
– Peteman
Nov 22 at 23:31
add a comment |
The first one works well enough. Thanks!
– Peteman
Nov 22 at 23:31
The first one works well enough. Thanks!
– Peteman
Nov 22 at 23:31
The first one works well enough. Thanks!
– Peteman
Nov 22 at 23:31
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434527%2fhow-do-you-select-vertices-in-a-maya-python-ls-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown