Home Technical Talk

Maya Python scripting help.

KeCzajkowski
polycounter lvl 12
Offline / Send Message
KeCzajkowski polycounter lvl 12
I'm trying to convert a script that I use for transferring UVs to use connect component to draw edges between selected verts. Current it draws a single line and then gives a weird error. Warning: Can't perform polyConnectComponents4 on selection Here's the current python script

import maya.cmds as cm

#grab all the selected objects

selectedObjects = cm.ls(sl=True)

#save first one into variable

#pop first one out of the selected objects list

driver = selectedObjects.pop(0)

#for each object in the selected objects list

for object in selectedObjects:

    cm.select([driver,object])

    #Connect Components

    cm.polyConnectComponents(ch=1,insertWithEdgeFlow=0, adjustEdgeFlow=1)

Any help or suggestions are appreciated



Replies

  • KeCzajkowski
    Offline / Send Message
    KeCzajkowski polycounter lvl 12
    For those of you who might find this via search I got some help on this and here's the script I ended up with.

    import maya.cmds as cm

    driver = cm.ls(sl=True,fl=1,tl=1)
    selectedObjects = cm.ls(sl=True,fl=1)

    selectedObjects.remove(driver[0])

    for object in selectedObjects:
        cm.select(driver,object)
        cm.polyConnectComponents(ch=1,insertWithEdgeFlow=0, adjustEdgeFlow=1)

    Popout doesn't work for this for whatever reason, I'm guessing it only works on objects rather than components.
    They also switch the selection to make the last selected component the target instead of the first as it's a bit easier to work that way.


Sign In or Register to comment.