PDA

View Full Version : Creating objects


nottoshabi
11-19-2009, 01:23 AM
I'm trying to create a tool that would create an object with the name of a selected object, then point and orient constraint the new object to the selected object. Also the new object needs to be grouped to its self twice before being constrained to the selected obj. It also needs to handle multiple selections. I have gotten this far but I'm having some troubles with the loop. This is what I have so far.





//Select obj to constraint to
string $objSel[] = `ls-sl`;



//Create null and constraint them to the selections
for ($i=0; $i<size($objSel); $i++)
{
//Empty selection
select -cl;

//Create null
string $nullCreate[] = `CreateEmptyGroup`;
print $nullCreate;

//Group the null to its self twice and name it as the selection in $objSel
group -n ("$objSel[$i]" + "01" + "_Grp") $nullCreate;
//Here I get an error saying that the name does not match.
//What name is it talking about?
group -n ("$objSel[$i]" + "02" + "_Grp") $nullCreate;
string $grpSel[] = `ls-sl`;

//Constraint new Grp to the existing
string $poConst[] =
`pointConstraint
-weight 1
$objSel $grpSel`;

string $orConst[] =
`orientConstraint
-weight 1
$objSel $grpSel`;

//Delete the constraints
delete $orConst $poConst;
}






Mods can you delete this post. Was made in the wrong place.

CGTalk Moderation
11-19-2009, 01:23 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.