v3.0
現在の SubComponent の特定のコンポーネントタイプと一致するコレクションオブジェクトを戻します。たとえば、次のようになります。
- VertexCollection は Vertex コンポーネントと一致(PolygonMesh 上)
- ControlPointCollection は ControlPoint コンポーネントと一致(NurbsCurveList および NurbsSurfaceMesh 上)
- EdgeCollection は Edge コンポーネントと一致(PolygonMesh 上)
- PolygonFaceCollection は PolygonFace コンポーネントと一致
- NurbsSurfaceCollection はサブサーフェイス(NurbsSurface)コンポーネントと一致(NurbsSurfaceMesh 上)
注: 同等のコンポーネント コレクションがない場合、空の XSICollection が戻されます(境界またはノットが NurbsSurfaceMesh 上で選択されている場合など)。
// get accessor Object rtn = SubComponent.ComponentCollection; |
/* This example demonstrates how to query the type of component that is currently selected. This can be useful if you are writing a tool that operates only on a specific subcomponent and you are checking to make sure the correct type of subcomponent has been selected by the user. */ NewScene( null, false ); var root = Application.ActiveSceneRoot; // For the purposes of this example we are creating // the cube and adding it to the selection var box = root.AddGeometry( "Cube", "MeshSurface" ); Selection.Add( box.ActivePrimitive.Geometry.Segments(0) ); // With one facet selected, the Selection.Item property // returns a CollectionItem from which you can retrieve // the SubComponent var first_selected = Selection.Item(0).SubComponent; Application.LogMessage( Application.ClassName(first_selected) ); // The SubComponent object gives you access to the actual // interface for the component type via its ComponentCollection // property (in this case, an Edge object) var component_collection = first_selected.ComponentCollection; Application.LogMessage( Application.ClassName(component_collection.Item(0)) ); // Expected results: //INFO : SubComponent //INFO : Edge |
set oObj = ActiveSceneRoot.AddGeometry("Cube","MeshSurface") set oPoint = oObj.ActivePrimitive.Geometry.Points(4) set oSubComponent = oPoint.SubComponent oSubComponent.AddElement 3 set oPoints = oSubComponent.ComponentCollection for each point in oPoints Application.LogMessage point.Index next |