CollectionItem がサブエレメントのコンテナの場合は、SubComponentオブジェクトを戻します。コンテナでない場合は、Nothing が戻されます。たとえば、ジオメトリコンポーネントが選択されている場合、Selection.Itemはこれらのサブエレメント(ポイント、エッジ、ファセットなど)を含む CollectionItem を戻します。CollectionItem を SubComponent に変換することにより、SubComponent.ComponentCollectionプロパティを使用して特定のジオメトリインターフェイス(ControlPointVertexEdgeNurbsCurve)を操作できるようになります。


// get accessor

SubComponent rtn = CollectionItem.SubComponent;

1. VBScript の例


'	This example demonstrates how to determine which edges are selected

'	in the UI by using the SubComponent object via the Selection


NewScene , false

' Setup: create a polygon mesh and select some edges on it

set disc = Application.ActiveSceneRoot.AddGeometry( "Disc", "MeshSurface" )


Selection.SetAsText( disc.Name & ".edge[113,115,117,119,121]" )

' When components are selected, the first member of the Selection

' is returned as a CollectionItem which can then be converted to a

' SubComponent object. From there, the ComponentCollection property

' converts it to the proper collection type (in this case an EdgeCollection)

set selected = Selection(0).SubComponent.ComponentCollection

for each sel in selected

	Application.LogMessage "edge[" & sel.Index & "] is selected." 


' Expected results:

'INFO : edge[113] is selected.

'INFO : edge[115] is selected.

'INFO : edge[117] is selected.

'INFO : edge[119] is selected.

'INFO : edge[121] is selected.

2. VBScript の例

set oRoot = Application.ActiveProject.ActiveScene.Root

set oObject = oRoot.AddGeometry("Cube", "MeshSurface", "MyCube")

set oItem = CreateObject("XSI.CollectionItem")

oItem.Value = oObject.FullName & "." & siVertexCluster & "[*]"

set oSubComponent = oItem.SubComponent