PDA

View Full Version : mirror and combine using mel


Geuse
04-19-2007, 09:54 AM
Hey. I'm trying to write a short script to mirror an object combine it and, weld points and freeze transformations and then delete history. This to just trying to learn and understand mel so I can make greater scripts in the future perhaps. I already got some help from this forum, but can't make the changes I want.


//(group) - (duplicate) - (scale -1) - (ungroup) - (freeze transformations) - (delete history)


group; xform -os -piv 0 0 0; //group the selected object so it's pivot point automatically lands in origin.


$groupName1 = `ls -sl -fl`; //returns the group name.


duplicate -rr; // duplicate the group.


$groupName2 = `ls -sl -fl`; //return the second group's name which you will scale in -1 in an array


setAttr ($groupName2[1] + ".scaleX") -1; //scale the group one unit in negative x


polyUnite -ch ($groupName1[1]) ($groupName2[1]); //I don't know the right way to write this. But basically I want to combine the two groups.

polyMergeVertex -d 0.01 -ch 1; //then just merge all the vertices

polySoftEdge -a 180 -ch 1; //and make sure the normals are smooth

FreezeTransformations;

DeleteHistory;

select -cl; //clear selection

illych sanchez
04-19-2007, 12:43 PM
hi ,

try this
hope it helps

string $sels[] = `ls -sl`;
select -r $sels[0];
group -n carz_mirror_grp;
xform -os -piv 0 0 0 carz_mirror_grp;
duplicate -rr carz_mirror_grp;
setAttr ("carz_mirror_grp1.scaleX") -1;
string $newobjs[] = `polyUnite -ch 1 ("carz_mirror_grp|" + $sels[0]) ("carz_mirror_grp1|" + $sels[0])`;
polyMergeVertex -d 0.01 -ch 1;
polySoftEdge -a 180 -ch 1;
FreezeTransformations;
DeleteHistory;
select -cl;


regards
pramod

Geuse
04-21-2007, 09:34 AM
Thank you very much. Exactly what I wanted.
This mel...Ah, well not gonna give up...yet.

CGTalk Moderation
04-21-2007, 09:34 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.