Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to get objects in a list which contains any regular expression ?

How to get objects in a list which contains any regular expression ?

gomidas95
Contributor Contributor
494 Views
1 Reply
Message 1 of 2

How to get objects in a list which contains any regular expression ?

gomidas95
Contributor
Contributor

Hello I am creating joints by given size and steps then I add circles (curve) for each. I need to connect rotation Attr like below to keep rotation with expected was since joints are connected like that. Now I want to select objects which has name gomi_MainBranc_+$branch_i+"_Circle" and plus ends with any number and here is an expected example: "gomi_MainBranch_0_Circle1967", "gomi_MainBranch_0_Circle1" so on...

 

What can I do to get those items in an array. I tried to use regular expression "*[0-9]". It is not recognized! There are items Called example "gomi_MainBranch_0_Circle1Shape". I do not want to get items with and different type or ending !

 

string $gomi_Circles[] = `ls ("gomi_MainBranch_"+$branch_i+"_Circle"+"*[0-9]")`;

for($i = 0; $i < size($gomi_Circles); ++$i)
{
if($i < (size($gomi_Circles)-1))
{
connectAttr(($gomi_Circles[($i)]+".rotate"),($gomi_Circles[($i+1)]+".rotate"));
}
}

 

0 Likes
495 Views
1 Reply
Reply (1)
Message 2 of 2

rajasekaransurjen
Collaborator
Collaborator

Hi,

In the ls command use the flag exactType with the value transform it will not list shape nodes.

 

string $gomi_Circles[] = `ls -exactType "transform" ("gomi_MainBranch_"+$branch_i+"_Circle"+"*[0-9]")`;

 

 

Best regards,
Rajasekaran Surjen.

0 Likes