getting the position is easy enough. If you're looking for index, I'm
pretty sure that MItGeometry has a .index() Also has a .position() for
it's coordinates. If you know you're dealing with faces you could also
use MItMeshPolygon to iter over the specified faces and grab the
information.

To get the original name with the index I actually just build that out
like so.

selectedVerts.append((dagPath.fullPathName() + ".vtx[%s]")
%compItr.index())

don't know a way or returning the dagPath of the components, but would
definitely be interested if it's possible.

Brandon L. Harris




On Dec 2, 2:04 am, Ling <[email protected]> wrote:
> Hi guys, I got a similar problem :
>
> ##############
> import maya.OpenMaya as om
> sel = om.MSelectionList()
> sel.add( 'pCubeShape1.f[0]' )
> dag = MDagPath()
> comp = MObject()
> sel.getDagPath( 0, dag, comp )
> #########################
>
> lines between ponds can get a MObject for pCubeShape1.f[0],
>
> 1.but if I run
> dagFn = om.MFnDagNode(MObject)
>
> if will have error like:
> RuntimeError: (kInvalidParameter): Object is incompatible with this
> method #
>
> is this because the MFnDagNode is for MObject handle pointing to a dag
> node instead of a component?
>
> 2. also,dose the components, such as poly face or poly edge has any
> bounding box?
> If it dosen't, I want to get all the points position on that poly
> face, and do some simple math, so how can get these positions?
>
> 3. After some conditions, I want to return the component MObject's
> string name,but
>
> dagPath.fullPathName()
> will return : # Result: |pCube1|pCubeShape1 #
>
> how can i get the original  'pCubeShape1.f[0]' instead?
>
> many thanks
>
> -ling
>
> On Nov 30, 9:40 pm, Paul Molodowitch <[email protected]> wrote:
>
> > Yeah.  It's listed as a 'known api limitation':
>
> > Selecting multiple types of object components
>
> > When multiple types of object components are selected, e.g. edges and
> > vertices, an MSelectionList that has been assigned the active selection list
> > will contain only the final type of component selected. For example if edges
> > were selected and then vertices were shift-selected the MSelectionList
> > representing the active selection list will contain one MObject representing
> > the vertex components.
>
> > Workaround
>
> > MItSelectionList list will differentiate between the different components
> > selected and can be used to identify all of the various components selected.
>
> > - Paul
>
> > On Mon, Nov 30, 2009 at 2:10 PM, Brandon Harris <[email protected]>wrote:
>
> > > That's odd. When I get the length of the active selection list it's
> > > only 1 but I can still itr through it?
>
> > >             # if no parents of this revision will be stripped, mark it as
> > >             # a savebase
>
> > > On Nov 30, 3:48 pm, Paul Molodowitch <[email protected]> wrote:
> > > > The powers that be have decreed that you need to use an MItSelectionList
> > > to
> > > > do this, I believe.
>
> > > > - Paul
>
> > > > On Mon, Nov 30, 2009 at 12:30 PM, Brandon Harris <[email protected]
> > > >wrote:
>
> > > > > Working on a way of getting an MSelectionList of multiple component
> > > > > types. For example, if I select both Vertices and Edges and then grab
> > > > > the active selection, it only returns the component type that was
> > > > > first selected so one of the types gets ignored.
>
> > > > > any help would be awesome!
>
> > > > > thanks!
>
> > > > > Brandon L. Harris
>
> > > > > --
> > > > >http://groups.google.com/group/python_inside_maya
>
> > > --
> > >http://groups.google.com/group/python_inside_maya
>
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to