RE: duplicate symmetry

Date : Tue, 26 Jul 2005 19:56:25 +0100
To : <XSI(at)Softimage.COM>
From : "kim aldis" <kim(at)aldis.org.uk>
Subject : RE: duplicate symmetry
Don't you just love regular expressions? The great thing about them is
no-one understands them. Oh the POWER!!! 

> -----Original Message-----
> From: owner-xsi(at)Softimage.COM 
> [mailto:owner-xsi(at)Softimage.COM] On Behalf Of brad
> Sent: 26 July 2005 19:45
> To: XSI(at)Softimage.COM
> Subject: Re: duplicate symmetry
> 
> The script below will do what you need using Regular 
> Expressions: 
> (http://msdn.microsoft.com/library/default.asp?url=/library/en
> -us/script56/html/js56jsgrpregexpsyntax.asp) 
> 
> // Strips numbers off end of name
> // Swaps leftStr and rightStr from the beginning of input 
> object names function NameSymmetry(inColl, leftStr, rightStr) {
> 	// verify input args and set defaults
> 	if(!inColl) inColl = Selection;	
> 	if(!leftStr) leftStr = 'Left';
> 	if(!rightStr) rightStr = 'Right';
> 	
> 	for(var e = new Enumerator(inColl); !e.atEnd(); e.moveNext()){
> 		var nm = e.item().name;
> 		
> 		// Strip off end numbers
> 		nm = nm.replace(/[\d]*$/,'');
> 		
> 		var leftRE = new RegExp('^' + leftStr);
> 		var rightRE = new RegExp('^' + rightStr);
> 
> 		// Test for leftStr		
> 		if(nm.match(leftRE)){
> 			nm = nm.replace(leftRE, rightStr);
> 		}
> 
> 		// Test for rightStr
> 		else if(nm.match(rightRE)){
> 			nm = nm.replace(rightRE, leftStr);
> 		}
> 		e.item().name = nm;
> 	}
> }
> 
> 
> -------Original Message-------
> >  if you duplicate symmetry a skeleton structure with the 
> word Right in 
> > it, it  will become RightNNN1.
> >  Is there something that make is easy to rename the new 
> structure so 
> > it  replace the word Right with Left  and removes the 1 on the end?
> >  
> >  cheers,
> >  Carl
> >  
> >  
> >  ---
> >  Unsubscribe? Mail Majordomo(at)Softimage.COM with the 
> following text in body:
> >  unsubscribe xsi
> >  
> -------Original Message-------
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following 
> text in body:
> unsubscribe xsi
> 
> 

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.