Selection または Selection オブジェクト/クラスは一種の専用コレクションです。選択されている各オブジェクトがメンバになり、列挙によって、あるいは Selection.Item または Selection::GetItem プロパティを使用してアクセスすることができます。
// C++ API Selection sel( Application().GetSelection() ); for( LONG i=0; i<sel.GetCount(); i++ ) { SIObject obj( sel[i] ); Application().LogMessage( obj.GetName() ); } SIObject objByIndex( sel.GetItem(0) ); // Access by index SIObject objByName( sel.GetItem(L"grid") ); // Access by name // C# (object model) CXSIApplication app = new CXSIApplication(); foreach (CollectionItem itm in app.Selection) { app.LogMessage(itm.Name, siSeverity.siInfo); } SIObject objByIndex = (SIObject)app.Selection[0]; // Access by index SIObject objByName = (SIObject)app.Selection["cone"]; // Access by name // JScript var e = new Enumerator( Selection ); for( ; !e.atEnd(); !e.moveNext() ) { var obj = e.item(); LogMessage( obj ); } var objByIndex = Selection(0); // Access by index var objByName = Selection("grid"); // Access by name ' VBScript foreach obj in Selection LogMessage obj next set objByIndex = Selection(0);' Access by index set objByName = Selection("grid");' Access by name # Python for obj in Application.Selection : Application.LogMessage( obj.Name ) objByIndex = Application.Selection(0) # Access by index objByName = Application.Selection("grid") # Access by name