Linear Curve Script

Took a quick break from rigging and wrote this script that basically creates a line between two objects using a curve. I’ve seen this kind of setup used a lot on pole vector controls so I thought I’d give it a shot.

As an update on my leg rig, I’m currently working to give it more robust squash and stretch controls. For the most part, the rig is complete, but it still is missing traits like an IK/FK align script. I’m still having trouble writing that.

import maya.cmds as cmds

Class that takes two points and creates a linear curve between them.
It then creates Clusters at those points and those clusters
are parented to those two objects.

class linearCrv(object):
def __init__(self,point1,point2):
# points 1 and 2 are the two objects we gave this script
self.point1 = point1
self.point2 = point2
# point 1 and 2 position can be static because we will later use constraints
self.point1Pos = cmds.xform(point1,q=1,t=1)
self.point2Pos = cmds.xform(point2,q=1,t=1)

self.crv = cmds.curve(degree=1,p=[(self.point1Pos),(self.point2Pos)]) + ".cv[0]")
self.cluster1 = cmds.cluster() + ".cv[1]")
self.cluster2 = cmds.cluster()


cmds.setAttr(self.cluster1[1] + ".visibility",0)
cmds.setAttr(self.cluster2[1] + ".visibility",0)

self.clusterGrp =,self.cluster2)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s