Skip to content

Instantly share code, notes, and snippets.

@AndresMWeber
Created June 2, 2017 00:08
Show Gist options
  • Save AndresMWeber/4791578b50e518f24d5483ea7e8ae8df to your computer and use it in GitHub Desktop.
Save AndresMWeber/4791578b50e518f24d5483ea7e8ae8df to your computer and use it in GitHub Desktop.
Create curve dense fake wireframe of component edges converted to degree 1 curves
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment