Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. /*
  2. Axle Finder
  3. Select two edge loops on a mesh and run the script.
  4. A locator will be created in the center of the two pieces with the correct axle.
  5. */
  6. string $Edges[] = `ls -sl`;
  7. int $SelSize = size($Edges);
  8. for($E=0; $E<$SelSize; ++$E){
  9. select -r $Edges[$E];
  10. polyToCurve -form 2 -degree 1 -n ("PollyToCurve" + $E);
  11. CenterPivot;
  12. spaceLocator -n ("CenterLoc_0" + $E);
  13. parentConstraint -n "SnapConst" -weight 1 ("PollyToCurve" + $E) ("CenterLoc_0" + $E) ;
  14. delete "SnapConst";
  15. delete ("PollyToCurve" + $E);
  16. }
  17. // Doing an aim const to find the correct axis of rotation
  18. aimConstraint -offset 0 0 0 -weight 1 -aimVector 1 0 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0 -n "AimConst" CenterLoc_00 CenterLoc_01;
  19. delete "AimConst";
  20. // Finding the center point of the locs
  21. float $LocA[] = `xform -q -t -ws "CenterLoc_00"`;
  22. float $LocB[] = `xform -q -t -ws "CenterLoc_01"`;
  23. // moving one of the locs to the mid point
  24. float $midPT[] = {($LocA[0] + $LocB[0])/2 ,($LocA[1] + $LocB[1])/2 ,($LocA[2] + $LocB[2])/2};
  25. xform -t $midPT[0] $midPT[1] $midPT[2] "CenterLoc_01";
  26. // deleting the other Loc
  27. delete "CenterLoc_00";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement