pythongeometrymayameshmaya-api

Change an objects mesh Node in Python Script?


Lets say I have a simple cube and a sphere, is their a way I can make the cubes mesh node match that of the sphere in python? Similar to the Modify --> Replace method. I have tried cmds.nodeCast but I dont want to switch them. Just to copy exactly from the other.


Solution

  • If you're ok with instances then you can select both objects and run this:

    import maya.cmds as cmds
    
    sel = cmds.ls(sl=True)
    cmds.connectAttr(sel[0] + ".outMesh", sel[1] + ".inMesh", force=True)