cwisbg

# delete based on boundingBox

Jan 25th, 2016
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. # delete based on boundingBox
  2. from pymel.core import*
  3. sl = selected()
  4. grpNodeArray = []
  5. for s in sl:
  6.     grpNode = createNode("group",n = s+"_group")
  7.     grpNodeArray.append(grpNode)
  8.     s.worldMesh >> grpNode.inGeometry
  9.     deleteNode = createNode("deleteComponent",n = s+"deleteComponent")
  10.     grpNode.outComponents >> deleteNode.deleteComponents
  11.     grpNode.outGeometry >> deleteNode.inputGeometry
  12.     meshNode = createNode("mesh",n = s+"mesh")
  13.     deleteNode.outputGeometry >> meshNode.inMesh
  14.     setAttr(s.visibility,0)
  15.     setAttr(grpNode.componentType,2)
  16.    
  17. boundingNode = createNode("boundingObject",n = s+"boundingObject")
  18. boundingNodeShape = listRelatives(boundingNode,p=1,s=1)
  19. boundingNodeShape[0].matrix >> boundingNode.inParentMatrix
  20. for g in grpNodeArray:
  21.     print g
  22.     boundingNode.outParentMatrix >> g.boundingObjects[0].boundParentMatrix
  23.     boundingNode.outData >> g.boundingObjects[0]
Advertisement
Add Comment
Please, Sign In to add comment