Something like this should have you covered.
for mesh in cmds.ls(selection=True, type="mesh"):
cmds.select("%s.f[0:]" % mesh)
cmds.sets(name="%s_set" % mesh)
The .f[] syntax is for selecting faces, it’s what you see echoed in the
Script Editor as you select a face interactively via the vi
Thanks a lot Marcus,
I was looking for an option with the API for speed, since I have scenes
with more than 1k objects, do you think it's not needed in this case ?
On Friday, June 18, 2021 at 3:01:43 a.m. UTC-4 Marcus Ottosson wrote:
> Something like this should have you covered.
>
> for mesh
You tell me. How long does it take currently? How often do you intend on
running it? How long would you like it to take?
On Fri, 18 Jun 2021 at 12:38, Alejandro wrote:
> Thanks a lot Marcus,
>
> I was looking for an option with the API for speed, since I have scenes
> with more than 1k objects,
I made a few tests on the usual number of elements, 2k / 1k, and it goes
smoothly, not bad!
Thanks a lot Marcus :)
On Friday, June 18, 2021 at 9:42:35 a.m. UTC-4 Marcus Ottosson wrote:
> You tell me. How long does it take currently? How often do you intend on
> running it? How long would you l
Cool. :) It should be fast, you’re more or less passing the burden of
actually iterating over the scene to those two commands which are already
implemented in C++. So it’s likely that trying to replicate this via the
Python API would be *more* expensive.
On Fri, 18 Jun 2021 at 14:56, Alejandro wr
1. don't override python keywords (e.g. "list")
2. are you stuck to api1 or is that ok to use api2?
3. Provide dag path instead of mobjects to your function sets if you can,
that'll let you work with world space
Then, you could start with something like this (api2):
fnSphere =
MFnMesh(MGlobal.ge
thanks vince, and that code was from the example I was building from...and
I had changed it to not be list in mine, but was running into the same error
On Fri, Jun 18, 2021 at 9:32 AM vince touache wrote:
> 1. don't override python keywords (e.g. "list")
> 2. are you stuck to api1 or is that ok
I totally agree. I had a problem like this before and I ended up using a
method similar to Marcus'.
As an additional note, something I found handy in the past was the
"-flatten" flag of the cmds.ls() command, which will return you a list with
one item for each component (faces, verts etc.).
for me