Python+Maya: Loop through curve vertex and fillet each

How can I got through each vertex of a basic curve and fillet the vertex, as long as it’s not the first or last vert?

Just doing a basic fillet in maya seems pretty setup heavy so I’d like to do it through code just looping through the selected splines vertex.

import maya.cmds as cmds
path = cmds.curve(d=1, p=[(0, 0, 0), (0, 0, 6), (5, 0, 6), (9, 0, 9)] )

I know that you can fillet a corner based on a radius by doing the following…

  1. Create a curve
  2. Select 2 ‘Curve Points’ with each one being on a different segment
  3. Run the Curve Fillet with ‘Trim’ and ‘Join’ on with the desired radius size.

What I’m wondering is if there is to possibly apply this approach and fillet all segments of a spline.


How can i make it join and trim the lines?


import maya.cmds as cmds
import random
#select all the locators you want to make curves on
locList = cmds.ls(sl = True)
sorted(locList)
crvList = []
#run locators through a loop and make a curve segment from 1 to another.
for index in range(0,len(locList)-1):
    crvName = "myCurve"+str(index) 
    aLocPos = cmds.xform(locList[index], q = True, t = True)
    bLocPos = cmds.xform(locList[index+1], q = True, t = True)
    cmds.curve(d=1,n=crvName, p=[(aLocPos[0], aLocPos[1], aLocPos[2]), (bLocPos[0], bLocPos[1], bLocPos[2])] )
cmds.select("myCurve*")
crvList=cmds.ls(sl=True)

#Curve fillet each segment section with random radius.
for index in range(0,len(crvList)-1):
    aCrv = crvList[index] 
    bCrv = crvList[index+1]
    randRadius = random.randrange(1, 3)
    cmds.filletCurve(aCrv, bCrv, r=randRadius)
    aCrv=cmds.ls(sl=True)