Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Orient stuff in maya
- # Select two objects, or components, and run. Will create a locator oriented along the two points
- # cwisbg.com
- from pymel.core import *
- def getPiv(s):
- select(s)
- setToolTo('Move')
- piv = manipMoveContext('Move', q=True, p=True,m=2)
- return piv
- def orient(point1, point2):
- l1 = spaceLocator(p = (0,0,0), n = "point1")
- move(l1, point1, ws=1)
- l2 = spaceLocator(p = (0,0,0), n = "point2")
- move(l2, point2, ws=1)
- aimConstraint(l1,l2)
- axesLctr = spaceLocator(p = (0,0,0), n = "axes")
- print l1
- p = pointConstraint([l1,l2], axesLctr)
- r = l2.getRotation()
- rotate(axesLctr,r)
- delete(p)
- delete(l1)
- delete(l2)
- sl = selected()
- point1 = getPiv(sl[0])
- point2 = getPiv(sl[1])
- orient(point1, point2)
- print "done"
Advertisement
Add Comment
Please, Sign In to add comment