I'm writing a script that duplicates curves from a selected mesh.
Once it has created the curve, I want it to rename the result based on the name of the original mesh that it used to create the curve with a suffix. Eg.: 'meshName_Crv' or something like that.
import pymel.core as pm
#Select meshes to use as a source for copying the curves.
tarlist = pm.ls(selection=True, fl=True)
#Select an edge within the selected meshes
edgelist = pm.ls(selection=True, fl=True)
alledgelist = []
for i in edgelist:
index = i.index()
for tar in tarlist:
tarpy = pm.PyNode(tar)
alledgelist.append(tarpy.e[index])
for edges in alledgelist:
pm.select(edges)
pm.mel.eval('SelectEdgeLoop;')
pm.mel.eval('polyToCurve -form 2 -degree 3;')
Currently it is creating curves with the default name 'polyToCurve'. But I need to rename based on the original source mesh.
I know that me code is not perfect so far... I'd appreciate any advice and help.