Align two objects
Mel Scripting January 31st, 2008
Description: This simple script could help you align 2 objects together. I put an option you could turn on if you like the object to be orientated as well. First, select the target object which you want to align to and then shift select the object that will get aligned.
global proc s_alignObjProc()
{
string $sel[]=`ls -sl`;
int $stateCb =`checkBox -q -v alignObjCB`;
if ($stateCb == 0)
{
delete `pointConstraint $sel[0] $sel[1]`;
} else
{
delete `parentConstraint $sel[0] $sel[1]`;
}
}
//Below is a simple window
if (`window -exists alignObjWindow`)
{
deleteUI alignObjWindow;
}
window -t "Align Objects" alignObjWindow;
rowColumnLayout -numberOfRows 2;
button -w 128 -bgc 0.95 0.75 0.75 -label "Align objects" -c s_alignObjProc;
checkBox -al "center" -label "with orientation" alignObjCB;
setParent..;
showWindow alignObjWindow;
December 17th, 2008 at 3:53 am
studing it ,I learn more things,especially “delete `pointConstraint $sel[0] $sel[1]`;”,
thanks
December 17th, 2008 at 10:25 am
You are welcome.