Home Technical Talk

(Maya)Creating curves with multiple edges?

polycounter lvl 16
Offline / Send Message
onionhead_o polycounter lvl 16
Is there anyway to convert multiple edges to curves in maya?

Replies

  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    modify>convert>polygon edges to curves

    or simply run
    CreateCurveFromPoly
    in a mel console.

    after doing this you will also want to rebuild the curve, since it;s segments will be based on the amount of edges in the converted selection.
    edit curves>rebuild curve

    or
    RebuildCurveOptions
    in the mel console
  • onionhead_o
    Options
    Offline / Send Message
    onionhead_o polycounter lvl 16
    Hey Passerby, thanks. I should've explained it more thoroughly. Im using polygon edges to curves method but it doesn't allow me to create multiple curves in one go. For example, I want to turn a cube into curves, polygon edges to curves will only be able to do one curve at a time. Would I have to use Mel, with something like a for loop, to store the edges selected, and then query them for CreateCurveFromPoly?
  • Bartalon
    Options
    Offline / Send Message
    Bartalon polycounter lvl 12
    So do you want each edge to be its own curve then? CreateCurveFromPoly will try to combine adjacent edges if the curve is possible and ignore the remainder. The following code will generate one curve per edge but will not attempt to combine adjacent edges:
    {
    string $edges[] = `ls -sl`;
    $edges = `filterExpand -sm 32`;
    for ($i=0; $i<`size $edges`; ++$i) {
        select $edges[$i];
        polyToCurve -form 2 -degree 1;
        CenterPivot;
    }
    }
    
  • onionhead_o
    Options
    Offline / Send Message
    onionhead_o polycounter lvl 16
    Thanks Bartalon. I will try to build upon the code that you provided
  • alpdeg
    Options
    Offline / Send Message
    Hi there,

    The code Bartalon provides workes fine. Now i'm looking for a way to alter the code so it creates curves for all the edge loops , instead of making a lot of curves for all the intersecting parts.
    Maybe by SelectEdgeLoopSp or by attachCurve ?

    I want to use the curves to do a extrude face over each curve.

    Hopefully somebody can help.

    Greetings Alex
  • vincentmcc
    Options
    Offline / Send Message
    vincentmcc null
    Same as ALDEG Did you get an answer Multiple edge loops to curve ?

  • g2mXagent
    Options
    Offline / Send Message
    g2mXagent polycounter lvl 4
    Same as ALDEG Did you get an answer Multiple edge loops to curve ?

    try this python script, select a object, run script.

    
    import maya.cmds as cmds
    objList = cmds.ls(selection=1)edgeNum = cmds.polyEvaluate(edge=1)edgeList = []i=0while i<edgeNum:    edgeList.append(i)    i+=1
    CurveList = []while edgeList:    usedEdgeList=cmds.polySelect(objList[0],edgeLoop=edgeList[0])    tmpCurveList=cmds.polyToCurve(form=3,degree=1)    cmds.matchTransform(tmpCurveList[0],objList[0],pivots=True)    CurveList.append(tmpCurveList[0])    for j in usedEdgeList:        if j in edgeList:            edgeList.remove(j)   
    for c in CurveList:    if (c!=CurveList[0]):        curveShapeList=cmds.pickWalk(c,direction="down",type="nodes")        cmds.parent(curveShapeList[0],CurveList[0],relative=True,shape=True)        cmds.delete(c)

  • g2mXagent
    Options
    Offline / Send Message
    g2mXagent polycounter lvl 4
    import maya.cmds as cmds

    objList = cmds.ls(selection=1)
    edgeNum = cmds.polyEvaluate(edge=1)
    edgeList = []
    i=0
    while i<edgeNum:
        edgeList.append(i)
        i+=1

    CurveList = []
    while edgeList:
        usedEdgeList=cmds.polySelect(objList[0],edgeLoop=edgeList[0])
        tmpCurveList=cmds.polyToCurve(form=3,degree=1)
        cmds.matchTransform(tmpCurveList[0],objList[0],pivots=True)
        CurveList.append(tmpCurveList[0])
        for j in usedEdgeList:
            if j in edgeList:
                edgeList.remove(j)   

    for c in CurveList:
        if (c!=CurveList[0]):
            curveShapeList=cmds.pickWalk(c,direction="down",type="nodes")
            cmds.parent(curveShapeList[0],CurveList[0],relative=True,shape=True)
            cmds.delete(c)
Sign In or Register to comment.