Hi ristjan,
sorry for not getting back to you earlier! Thanks for your
help, I've managed to get the information I was looking for. Turns out
vertex normal did gave me what I was looking for but since I did not build
an up vector for the matrix the locator did not know how to orient it self.
Using connectedVertices to build the up vector was what I ended up doing.
Thanks again!
Thank you
Gann Boon Bay
On Tuesday, August 5, 2014 1:21:03 AM UTC-7, ristjan wrote:
>
> Hi,
>
> You can use MItMeshPolygon and it's method getConnectedFaces to obtain
> connected polygon id's for each vertex.
>
> For example:
>
> import maya.OpenMaya as OpenMaya
>
> mSelectionList = OpenMaya.MSelectionList()
> OpenMaya.MGlobal.getActiveSelectionList(mSelectionList)
> mObject = OpenMaya.MObject()
> mSelectionList.getDependNode(0, mObject)
> polyIterator = OpenMaya.MItMeshPolygon(mObject)
> while not polyIterator.isDone():
> polygonArray = OpenMaya.MIntArray()
> polyIterator.getConnectedFaces(polygonArray)
> # do something with polygonArray
> polyIterator.next()
>
>
> The code is just an example of the top of my head. I can't actually check
> if it works since I don't have access to Maya at the moment :)
>
> Cheers,
> Risto
>
>
>
>
> On Tue, Aug 5, 2014 at 3:54 AM, Bay <[email protected] <javascript:>>
> wrote:
>
>> Hi,
>> I'm attempting to write a tool that allows me to attach and align an
>> object according to a vertex normal. So far I've gotten it to work well on
>> meshes that are higher res (as shown in the screenshot) but on lower res
>> meshes I run into the problem where a single vertex has multiple normals,
>> each the same as the vertex's adjacent polygons. How would I obtain the
>> IDs of the faces that are connected to this vertex? Any assistance is much
>> appreciated.
>>
>>
>>
>> <https://lh5.googleusercontent.com/-Y6PfEu4Y3Ec/U-Am-G_8ANI/AAAAAAAAASk/lkfRouIjFjw/s1600/Screen+Shot+2014-08-04+at+5.16.21+PM.png>
>> Thank you
>> Gann Boon Bay
>>
>> --
>> 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] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/17296e41-ba80-485c-bbc8-d0f50db8cc73%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/python_inside_maya/17296e41-ba80-485c-bbc8-d0f50db8cc73%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/2f7e3c55-b698-4034-a89b-7f47a6c294df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.