  | | | select by wire color | select by wire color 2005-02-22 - By Guillaume Laforge
Back eheh ! Mine is longer than yours ;-)
Seriously, where do you find "CCACF571-B1B8-11d3-9E9B-009027BC38DD" ??? And it run really faster !
Cheers.
Guillaume Laforge CG artist www.vol2nuit.fr
-- -- Original Message -- -- From: "Bernard Lebel" <softimage@(protected)> To: <XSI@(protected)> Sent: Tuesday, February 22, 2005 12:37 AM Subject: Re: select by wire color
> My god! That's a bunch of lines there Guillaume! ;-) > > > // Create empty collection to store display properties > var oColl = XSIFactory.CreateObject( "XSI.Collection" ); > > // Find and enumerate display properties > // ATTENTION TO EMAIL FORMATTING: > // The following, up to and including .moveNext() ), is one line! > for( var oPropsEnum = new Enumerator( findobjects( null, > "{CCACF571-B1B8-11d3-9E9B-009027BC38DD}" ) ); !oPropsEnum.atEnd(); > oPropsEnum.moveNext() ) > { > // Test wire color index value, -->> put your own value here! > if( oPropsEnum.item().parameters( "wirecol" ).value == 3 ) > { > oColl.add( oPropsEnum.item().parent ); > } > } > > // Select objects > selectobj( oColl ); > > > > Guillaume Laforge wrote: >> Hi, >> I'm currently learning scripting and I find your pb interesting :-) >> My script is far to be finished ( no check to know if the collections are >> empty, no interface to enter your color number etc...) but it works :-) >> Just change the number by yours in var oWireColor = 50 >> >> //-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- >> >> //Sel_by_wire_color.js >> //Learning scripting >> //Guillaume Laforge Feb. 2005 >> >> //This script select all the polymeshes with a given wire color index. >> >> //Change the color here : >> var oWireColor = 50 >> >> //Create empty collection to store polymeshes >> var oPoly = new ActiveXObject( "XSI.Collection" ); >> >> //Create empty collection to store the good color polymeshes >> var oGoodColorPoly = new ActiveXObject( "XSI.Collection" ); >> >> //add polymeshes to the collection >> oPoly.additems( ActiveSceneRoot.FindChildren ("" , siPolyMeshType ));; >> >> // Iterate collected polymeshes >> var eCollItems = new Enumerator( oPoly ); >> eCollItems.moveFirst(); >> for (; !eCollItems.atEnd(); eCollItems.moveNext() ) >> { >> var oItem = eCollItems.item(); >> oColor = GetValue(oItem+".display.wirecol"); >> if (oColor == oWireColor ){ >> logmessage ("Find the wire color objects"); >> oGoodColorPoly.additems ( oItem ); >> SelectObj ( oGoodColorPoly ); >> } else { >> logmessage ( "finished"); >> } >> } >> > > --- > Unsubscribe? Mail Majordomo@(protected) with the following text in body: > unsubscribe xsi >
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |