  | | | select by wire color | select by wire color 2005-02-21 - By Guillaume Laforge
Back 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"); } }
//-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- ---- ---- ---- ---- ---- ------
Tell me if you've got a pb.
Cheers,
Guillaume Laforge CG artist www.vol2nuit.fr
-- -- Original Message -- -- From: "Victor Luckysov" <vic@(protected)> To: <XSI@(protected)> Sent: Monday, February 21, 2005 2:21 PM Subject: select by wire color
> Hello XSI users, > > How can i selects some objects by wire color ? > > > > /vic/ > senior animator > dr.Picture Studios www.drpicture.com > personal web: www.vic3d.com > > > --- > Unsubscribe? Mail Majordomo@(protected) with the following text in body: > unsubscribe xsi > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <META content="MSHTML 6.00.2900.2604" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=Arial size=2>Hi,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I'm currently learning scripting and I find your pb interesting :-)</FONT></DIV> <DIV><FONT face=Arial size=2>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 :-)</FONT></DIV> <DIV><FONT face=Arial size=2>Just change the number by yours in var oWireColor = 50</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>//-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- ---</FONT></DIV> <DIV> <P><FONT face=Arial size=2>//Sel_by_wire_color.js<BR>//Learning scripting <BR>//Guillaume Laforge Feb. 2005</FONT></P> <P><FONT face=Arial size=2>//This script select all the polymeshes with a given wire color index.</FONT></P> <P><FONT face=Arial size=2>//Change the color here :<BR>var oWireColor = 50</FONT></P> <P><FONT face=Arial size=2>//Create empty collection to store polymeshes<BR>var oPoly = new ActiveXObject( "XSI.Collection" );</FONT></P> <P><FONT face=Arial size=2>//Create empty collection to store the good color polymeshes <BR>var oGoodColorPoly = new ActiveXObject( "XSI.Collection" );</FONT></P> <P><FONT face=Arial size=2>//add polymeshes to the collection<BR>oPoly.additems ( ActiveSceneRoot.FindChildren ("" , siPolyMeshType ));;</FONT></P> <P><FONT face=Arial size=2>// Iterate collected polymeshes<BR>var eCollItems = new Enumerator( oPoly ); <BR>eCollItems.moveFirst();<BR>for (; !eCollItems.atEnd(); eCollItems.moveNext() ) <BR>{<BR>var oItem = eCollItems.item();<BR>oColor = GetValue(oItem+".display.wirecol");<BR>if (oColor == oWireColor ){<BR>logmessage ("Find the wire color objects");<BR>oGoodColorPoly.additems ( oItem );<BR>SelectObj ( oGoodColorPoly );<BR>} else {<BR>logmessage ( "finished");<BR>}<BR>}</FONT></P> <P><FONT face=Arial size=2>//-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- -- ---- ---- ---- ---- ---- ---- ---- ---</FONT></P> <P><FONT face=Arial size=2>Tell me if you've got a pb.<BR></FONT></P> <P><FONT face=Arial size=2>Cheers,</FONT></P> <P><FONT face=Arial size=2>Guillaume Laforge<BR>CG artist<BR></FONT><A href="http://www.vol2nuit.fr"><FONT face=Arial size=2>www.vol2nuit.fr</FONT></A></P> <P> </P></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>-- -- Original Message -- -- </FONT> <DIV><FONT face=Arial size=2>From: "Victor Luckysov" <</FONT><A href="mailto:vic@(protected)"><FONT face=Arial size=2>vic@(protected)</FONT></A><FONT face=Arial size=2>></FONT></DIV> <DIV><FONT face=Arial size=2>To: <</FONT><A href="mailto:XSI@(protected)"><FONT face=Arial size=2>XSI@(protected)</FONT></A><FONT face=Arial size=2>></FONT></DIV> <DIV><FONT face=Arial size=2>Sent: Monday, February 21, 2005 2:21 PM</FONT></DIV> <DIV><FONT face=Arial size=2>Subject: select by wire color</FONT></DIV></DIV> <DIV><FONT face=Arial><BR><FONT size=2></FONT></FONT></DIV><FONT face=Arial size=2>> Hello XSI users,<BR>> <BR>> How can i selects some objects by wire color ?<BR>> <BR>> <BR>> <BR>> /vic/<BR>> senior animator<BR>> dr.Picture Studios </FONT><A href="http://www.drpicture.com"><FONT face=Arial size=2>www.drpicture.com</FONT></A><BR><FONT face=Arial size=2>> personal web: </FONT><A href="http://www.vic3d.com"><FONT face=Arial size=2>www.vic3d.com</FONT></A><BR><FONT face=Arial size=2>> <BR>> <BR>> ---<BR>> Unsubscribe? Mail </FONT><A href="mailto:Majordomo@(protected)"><FONT face=Arial size=2>Majordomo@(protected)</FONT></A><FONT face=Arial size=2> with the following text in body:<BR>> unsubscribe xsi<BR>></FONT></BODY></HTML>
|
|
 |