Here is a random example from the API docs, showing both how you could be
using an MItSelectionList (instead of using a python range loop), and also
how they switch on the component type to handle it in different ways:

http://docs.autodesk.com/MAYAUL/2014/ENU/Maya-API-Documentation/index.html?url=cpp_ref/cv_pos_cmd_2cv_pos_cmd_8cpp-example.html,topicNumber=cpp_ref_cv_pos_cmd_2cv_pos_cmd_8cpp_example_html5f2e813d-1406-4856-a1d4-96fb60bf1897

Its a c++ example, but I am sure you can translate it.


On Wed Jan 14 2015 at 08:33:40 <[email protected]> wrote:

> Hey Guys,
>
> Working on some more tools right now, using python 1.0 api to try to speed
> things up.
>
> It's not immediately obvious to me how to deal with different component
> types.
>
> So If I do something like
>
> #==========
> sel = om.MSelectionList()
> om.MGlobal.getActiveSelectionList( sel )
>
> mDag = om.MDagPath()
> mComp = om.MObject()
> for i in xrange( sel.length() ):
>     mSel.getDagPath(i, mDag, mComp)
>
> #===========
>
> What sort of function set, or Iterator would I use on mComp, if mComp
> contains vertices, faces, and or edges?
>
> I know I can do something like
>
> if mComp.hasFn( MFn.kMeshVertComponent )
>
> But how do I best deal with not knowing the type of component(s) in
> mComp(MObject)?
>
> Thanks!
> Kev
>
>
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/52e9da24-18fe-43c5-8498-
> 78cd872dd421%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA34dZ3qT%3D5r_TeFE%2BwC27WUmGCA38QiULJm2%2BKaiwgn1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to