コンポーネントが選択されている場合、Selection.Item プロパティが CollectionItem オブジェクトを戻します。このオブジェクトは、CollectionItem.SubComponent プロパティを介して SubComponent オブジェクトを取得するのに使用できます。次に、SubComponent.ComponentCollection プロパティが、選択されたコンポーネントを含む、ジオメトリ専用のコンポーネント コレクション(VertexCollection、ControlPointCollection、EdgeCollection など)を戻します。のうち 1 つを返します。
// C# -- assuming sampled points are selected CXSIApplication app = new CXSIApplication(); CollectionItem collitem = (CollectionItem)app.Selection[0]; SubComponent subcmp = (SubComponent)collitem.SubComponent; SampleCollection smplcoll = (SampleCollection)subcmp.ComponentCollection; app.LogMessage("There are " + smplcoll.Count.ToString() + " selected samples.", siSeverity.siInfo); foreach (Sample smpl in smplcoll) { app.LogMessage("Current sample[" + smpl.Index.ToString() + "] (prev:[" + smpl.Navigate(siNavigateComponentType.siPreviousComponent).Index.ToString() + "]; next:[" + smpl.Navigate(siNavigateComponentType.siNextComponent).Index.ToString() + "])", siSeverity.siInfo); } // JScript -- assuming control points are selected var subcmp = Selection(0).SubComponent; var ctrlpts = subcmp.ComponentCollection; for( var i=0; i<ctrlpts.Count; i++ ) { LogMessage( "Position of ctrlpt[" + ctrlpts(i).Index + "]: " + ctrlpts(i).X + "," + ctrlpts(i).Y + "," + ctrlpts(i).Z ); } ' VBScript -- assuming vertices are selected set subcmp = Selection(0).SubComponent for each vtx in subcmp.ComponentCollection LogMessage vtx.Index & " has " & vtx.Nodes.Count & " polygon nodes" next # Python -- assuming edges are selected subcmp = Application.Selection(0).SubComponent for edg in subcmp.ComponentCollection : Application.LogMessage( "edge[%s] is hard: %s" % (edg.Index,edg.IsHard) )