Combine multiple curves into a single object

Combine multiple curves into a single object

The-Digital-Shaman
Advocate Advocate
5,904 Views
3 Replies
Message 1 of 4

Combine multiple curves into a single object

The-Digital-Shaman
Advocate
Advocate

Hi guys,

 

How do you go about combining multiple curves into a single object?

Maya's attach command unnecessarily tries to blend connect the curves I have.

 

How to prevent this to happen?

I've tried all the options in the Options window.

 

Cheers,
DS

 

0 Likes
Accepted solutions (1)
5,905 Views
3 Replies
Replies (3)
Message 2 of 4

The-Digital-Shaman
Advocate
Advocate
Accepted solution

https://www.youtube.com/watch?v=JcVd5dtD35A

 

This guy's workaround is brilliant!

 

Although doesn't really combine multiple curves into a single object. 

Just soft of groups them.

 

So when using sweep mesh, we still end up with multiple objects. Uh

0 Likes
Message 3 of 4

Kahylan
Advisor
Advisor

Hi!

 

Yeah sadly there isn't really a way to combine curve shapes without maya trying to interpolate the end of one curve to being attached to the start of another, thats just how curves are calculated in maya.

 

What you can do, is parent multiple shapes to one transform. Thats something that you do rather often when rigging. So I wrote a script for that:

import maya.cmds as mc

def groupShapesUnderLast():
    """
    Groups shapes of all nurbscurves in selected Hierarchies under the last selected transform
    """
    
    sl = mc.ls(sl=True)
    
    
    par = sl.pop(-1)
    parPiv = mc.xform(par, q= True, ws= True, piv= True)
    
    curvesList = []
    pivList = []
    
    for s in sl:
        piv = mc.xform(s,q= True, ws= True, piv= True)
        pivList.append(piv)
        mc.xform(s, piv= (parPiv[0],parPiv[1],parPiv[2]), ws= True)
        cList = mc.listRelatives(s, c= True, ad =  True, type = "nurbsCurve")
        if cList != None:
            curvesList= curvesList + cList
    
    mc.parent(*curvesList, par, s= True)
    
    dList= []
    
    for i in range(0,len(sl)):
        mc.xform(sl[i], piv= (pivList[i][0],pivList[i][1],pivList[i][2]), ws= True)
        decend = mc.listRelatives(sl[i], ad= True)
        if decend == None:
            dList.append(sl[i])
        else:
            check= 0
            for d in decend:
                if mc.objectType(d) != "transform":
                    check= 1
            if check == 0:
                dList.append(sl[i])
                
    mc.delete(dList)

groupShapesUnderLast()

 

But that still leaves you with multiple shapes so sweepmesh wont work. But as far as I know, there are Bifrost and MASH solutions generate a single mesh from multiple curves.

 

I hope it helps!

Message 4 of 4

The-Digital-Shaman
Advocate
Advocate

Thanks, I will try your script.


From your description it does what it shown in the video I posted link to.

 

Btw, you can do sweep mesh for multiple curves attached to a single transform.

You just need to show shapes in outliner and select individual shapes!

0 Likes