Detach edges based on whether they are hard or soft

Detach edges based on whether they are hard or soft

p.f.ramm
Observer Observer
697 Views
1 Reply
Message 1 of 2

Detach edges based on whether they are hard or soft

p.f.ramm
Observer
Observer

This might be a bit of an odd request, but I need to find a way to detach edges based on whether an edge is hard or not. (ex. If edge is hard, detach, else if soft, don't detach)

I'm not sure the best way to approach this as I haven't worked with Maya scripting. I've got experience in Python, but I don't know where to start with this one. 

 

If anyone has ideas on how you would approach this problem, I would greatly appreciate!

0 Likes
698 Views
1 Reply
Reply (1)
Message 2 of 2

jmreinhart
Advisor
Advisor
def detach_hard_edges():
    #get the selected object
    sel = cmds.ls(sl = True)
    if not sel:
       return
    
    mesh = sel[0]
    
    mesh = mesh.split('.')[-1] 
 
    if cmds.nodeType(mesh) == 'transform':
        shapes = cmds.listRelatives(mesh, s = True)
        if shapes:
            mesh = shapes[0]
        else:
            return

    if cmds.nodeType(mesh) != 'mesh':
        return
    
    #select all the hard edges
    cmds.select(mesh)
    cmds.polySelectConstraint(m = 3, t = 0x8000, sm = 1)
    
    cmds.DetachComponent()
    
    cmds.polySelectConstraint(disable = True)  

 

0 Likes