インストールされている Command をすべて含むコレクションを CommandCollection として戻します。ビルトインコマンドおよびカスタムコマンドもこの中に含まれます。
// get accessor CommandCollection rtn = XSIApplication.Commands; |
/* This example demonstrates some of the functionality of filtering command collections by showing: 1. How to filter out everything but the modeling commands (ie., subset{modeling}) 2. How to filter out everything but the commands with either 'modeling' or 'deformation' as keywords (ie., union{modeling,deformation}) 3. How to use nested filtering to produce a collection of commands that match *both* 'modeling' and 'deformation' (ie., intersection{modeling,deformation}) */ // ------------------------------------------------------ // 1: SIMPLE SUBSET{modeling} // var coll_mo = Application.Commands.Filter( "modeling" ); LogMessage( "Found " + coll_mo.Count + " modeling commands." ); // ------------------------------------------------------ // 2: UNION{modeling,deformation} // // You can use an array of keywords to get any command that // has *either* 'modeling' or 'deformation' as a keyword. aKeywords = new Array( "modeling", "deformation" ); var coll_umd = Application.Commands.Filter( aKeywords ); LogMessage( "Found " + coll_umd.Count + " modeling and/or deformations commands." ); // ------------------------------------------------------ // 3: INTERSECT{modeling,deformation} // // To find each command that has *both* 'modeling' and // 'deformation' as keywords, first filter for one value // and then use the returned collection to filter for // the other value. var coll_do = Application.Commands.Filter( "deformation" ); var coll_imd = coll_do.Filter( "modeling" ); LogMessage( "Found " + coll_imd.Count + " modeling and deformations commands:" ); // You can enumerate over the collection using the JScript // Enumerator object to access each member var e = new Enumerator(coll_imd) for ( ; !e.atEnd(); e.moveNext() ) { LogMessage( "\t" + e.item() ); } // ------------------------------------------------------ // RESULTS: // //INFO : "Found 235 modeling commands." //INFO : "Found 311 modeling and/or deformations commands." //INFO : "Found 13 modeling and deformations commands:" //INFO : " Disconnect Operator Parameter" //INFO : " Deform by Cluster Center with Nulls Creation" //INFO : " MCP Setting: Set Proportional Modeling" //INFO : " Deform by Cluster Center with Nulls Creation" //INFO : " Deform by Cluster Center" //INFO : " MoveComponent Tool" //INFO : " Move Point Tool" //INFO : " Curve Snap" //INFO : " Continuity Manager" //INFO : " MCP Setting: Set Frame Relative Move Component" //INFO : " MCP Setting: Unset Frame Relative Move Component" //INFO : " MCP Setting: Unset Proportional Modeling" //INFO : " Connect Operator Parameter" |