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 <voidrea...@gmail.com> wrote:

> 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 like it to take?
>>
>> On Fri, 18 Jun 2021 at 12:38, Alejandro <voidr...@gmail.com> 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, 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 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 viewport.
>>>>
>>>> On Fri, 18 Jun 2021 at 00:44, Alejandro <voidr...@gmail.com> wrote:
>>>>
>>>>> Hello guys!,
>>>>>
>>>>> What would be the fastest solution to store all the face components
>>>>> for each object I select into its correspondent set?
>>>>>
>>>>> I'm trying something like this:
>>>>>
>>>>> mesh = maya.cmds.ls(selection=True, type='mesh')[0]
>>>>> selection_list = OpenMaya.MSelectionList()
>>>>> selection_list.add(mesh)
>>>>> dag_path = selection_list.getDagPath(0)
>>>>> mfn_mesh = OpenMaya.MFnMesh(dag_path)
>>>>>
>>>>> v_count, ids = mfn_mesh.getTriangles()
>>>>>
>>>>> but these are only triangle counts and vtx indexes, how could I have
>>>>> the full face element and store in a set ?
>>>>>
>>>>> thank you !
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Python Programming for Autodesk Maya" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to python_inside_m...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/python_inside_maya/24a2b1e9-f975-4461-97a1-e1155b235973n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/python_inside_maya/24a2b1e9-f975-4461-97a1-e1155b235973n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to python_inside_m...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/66b60eee-81c2-4ea5-9f77-effe7565d39an%40googlegroups.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/66b60eee-81c2-4ea5-9f77-effe7565d39an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/5e7dd6e7-ff12-4c8c-b5c2-aaaaafee720bn%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/5e7dd6e7-ff12-4c8c-b5c2-aaaaafee720bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBZ10508id9V4yM9MrePJSRitKqqLefz4XvqFt0y2eVNw%40mail.gmail.com.

Reply via email to