Skip to main content

Create Joints from Every Cvs of Curve

import pymel.core as pm

curve_obj = pm.ls(sl=True)[0]
curve_local_points = curve_obj.getCVs("world")
len_local_points = curve_obj.numCVs()
curve_name = curve_obj.getName()


print (len(curve_local_points))

# Iterate through the curve_local_points and create a joint with the same position of each point

'''
for i, point in enumerate(curve_local_points):
pm.select(clear=True)
#joint_obj = pm.joint(position=point, name="test")
#cv[0].getName()
#constraint = pm.parentConstraint(joint_obj, curve_obj.cv[i])
'''


for i in range(len_local_points):
pm.select(clear=True)
point = curve_local_points[i]
print (point)
joint_obj = pm.joint(position=point, name=curve_name+"_con")
pm.select(clear=True)

pm.joint(position=curve_obj.getTranslation(), name=curve_name +"_main")
import pymel.core as pm

curve_obj = pm.ls(sl=True)[0]
curve_local_points = curve_obj.getCVs("world")

# Iterate through the curve_local_points and create a joint with the same position of each point
joints = []
for point in curve_local_points:
pm.select(clear=True)
joint = pm.joint(position=point)
joints.append(joint)
import pymel.core as pm

curve_obj = pm.ls(sl=True)[0]
curve_local_points = curve_obj.getCVs("world")
len_local_points = curve_obj.numCVs()
curve_name = curve_obj.getName()


print (len(curve_local_points))

# Iterate through the curve_local_points and create a joint with the same position of each point

'''
for i, point in enumerate(curve_local_points):
pm.select(clear=True)
#joint_obj = pm.joint(position=point, name="test")
#cv[0].getName()
#constraint = pm.parentConstraint(joint_obj, curve_obj.cv[i])
'''


for i in range(len_local_points):
pm.select(clear=True)
point = curve_local_points[i]
print (point)
joint_obj = pm.joint(position=point, name=curve_name+"_con")
pm.select(clear=True)

pm.joint(position=curve_obj.getTranslation(), name=curve_name +"_main")