I'm not really understanding what you want to do but I'll take a stab at it.

You've got a list of vertex positions in your target mesh 
(target_mesh_verts)
You've got a list of component indices from your first mesh (indices)
I'm not clear on how you want to use them together.

You will probably want to do something like
for i in indices:
    target_mesh_verts[i] = something
target_mesh.setPoints(target_mesh_verts)

Note that can fail (IndexError) if there are more verts in your first mesh 
than there are in your target mesh.

On Friday, 10 February 2017 09:31:54 UTC+11, [email protected] wrote:
>
> hello, 
>
> i've stored a selection of verts from one mesh. And i've stored all the 
> verts from another mesh. 
>
> im trying to copy the selection of verts from the first mesh into the list 
> of the second mesh. So all the corresponding vert points get implanted into 
> the second mesh's vert list. 
>
> Then i just want to use setPoints to set all the vert points back onto the 
> second mesh. Effectively copying the relative position of the selected 
> verts onto the other mesh. 
>
> i think i'm very nearly there with this code so far: 
>
> ######################################################## 
> import maya.api.OpenMaya as om 
>     
>
> def getPoints(geo): 
>         
>     sel = om.MSelectionList() 
>     sel.add(geo) 
>     selObj = sel.getDagPath(0)     
>     mesh = om.MFnMesh(selObj) 
>     
>     return mesh, mesh.getPoints() 
>
>
> def implantPtPositions(targetMesh,target_mesh_verts,indices): 
>
>     #cycle through selected verts and copy them into the second mesh verts 
> list   
>     # HERE HERE HERE 
>         
>     #then use this new list to set the points of the second mesh 
>     targetMesh.setPoints(newVerts,om.MSpace.kObject) 
>
>
> #store the vert positions for the second mesh 
> (targetMesh, target_mesh_verts) = getPoints("target") 
>
> #store selected vert points 
> sel_list = om.MGlobal.getActiveSelectionList() 
> (mDagPath, component) = sel_list.getComponent(0) 
> comp_fn = om.MFnSingleIndexedComponent(component) 
> indices = comp_fn.getElements() 
>
> #set the mesh difference to the target mesh 
> implantPtPositions(targetMesh,target_mesh_verts,indices) 
>
> ######################################################## 
>
> I just need to know how to cycle through the selected verts and copy them 
> over to the second mesh ("target") list. so i can then use that new verts 
> list in the setPoints function. 
>
> can anyone help me out here,thanks 
>
> Sam 
>

-- 
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/ff33e6d1-aff6-4e18-a17e-c4ce2160e8f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to