PDA

View Full Version : Duplicate command


labbejason
09-14-2010, 11:22 PM
Hello,

I'm having problems returning an array of LONG names from the duplicate command.

For example:
- Create 2 spheres, pSphere1 and pSphere2
- Link pSphere2 to pSphere1
- Select them and run this MEL:

{
string $objs[] = `ls -l -sl`;
string $newObjs[] = `duplicate $objs`;
select $newObjs;
}

// Error: More than one object matches name: pSphere2 //

It fails to select as $newObjs is not returning the long name of the duplicate objects (only returns pSphere2). I don't see any flag from the duplicate command that would return the full path of their names. Is there some sort of trick to this that I'm missing?

Thanks!

Mark-J
09-15-2010, 08:27 AM
No trick to it, it just doesn't return the long name. What you end up doing is just defining the new objects after the duplicate on the basis that those duplicates are left selected


string $objs=`ls -sl -l`;
duplicate;
string $newObjs=`ls -sl -l`;


Or use Pymel ;)

labbejason
09-15-2010, 05:51 PM
That seems to work good! Just need to make sure that the objects that are going to be duplicated are selected or it doesn't select the duplicates.

norbertnacu
09-15-2010, 10:25 PM
string $dupCmd[] = (duplicate(`ls -sl -l`))
string $sel[] = `ls -sl -l`;

labbejason
09-17-2010, 12:00 AM
Good too, thanks Nobert :)

ewerybody
09-22-2010, 12:30 PM
If you actually only want the resulting array, why create more? And why tell duplicate to do stuff it does by default? i.e.: duplicating whats selected:
string $objects[] = duplicate();
$objects = `ls -sl -l`;

CGTalk Moderation
09-22-2010, 12:30 PM
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.