import maya.cmds as cmdsimport pymel.core as pm
edges = cmds.filterExpand(cmds.polyListComponentConversion(te=1),sm=32,ex=1)cur_list = []for edge in edges: vtx = cmds.ls(cmds.polyListComponentConversion(edge,fe=1,tv=1),fl=1) p1 = cmds.pointPosition(vtx[0]) p2 = cmds.pointPosition(vtx[1]) created_curve = cmds.curve(d=1,p=(p1,p2)) cur_list.append(created_curve)
# Select all the newly created curvesfor cur in cur_list: cmds.select(cur, add=True)
# Get list of objectsshape_list = pm.ls(pm.listRelatives(c=True))grp_list = pm.ls(pm.group(em=True, n='curve#'))list_all = []for obj in grp_list: list_all.extend(shape_list) list_all.extend(grp_list)
# Parent (shape) objects to one Curvepm.select(list_all)pm.parent(r=True, s=True)--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/71af008c-fbce-46a8-b150-887888e300bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
for edge in edges: p1 = cmds.pointPosition(vtx[0]) p2 = cmds.pointPosition(vtx[1]) created_curve = cmds.curve(d=1,p=(p1,p2)) cur_list.append(created_curve)for obj in grp_list: list_all.extend(shape_list) list_all.extend(grp_list)To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/71af008c-fbce-46a8-b150-887888e300bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a5b72dff-2d28-40dd-9c98-5a02af3529b0%40googlegroups.com.
import maya.cmds as cmds
cmds.refresh(suspend=True)
selection_edges = cmds.filterExpand(cmds.polyListComponentConversion(te=1), sm=32, ex=1)
curve_transforms = []
for edge in selection_edges:
vertices = cmds.ls(cmds.polyListComponentConversion(edge, fe=1, tv=1), fl=1)
created_curve = cmds.curve(d=1, p=[cmds.pointPosition(vertex) for vertex in vertices])
curve_transforms.append(created_curve)
# Get list of objects
shapes = [cmds.listRelatives(transform)[0] for transform in curve_transforms]
curve_transform = cmds.group(em=True)
pm.parent(shapes, curve_transform, r=True, s=True)
cmds.delete(curve_transforms)
cmds.refresh(suspend=False)
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/71af008c-fbce-46a8-b150-887888e300bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.