SubComponent.ComponentCollection operator

Introduced

v3.0

Description

Returns the collection object matching the specific component type for the current SubComponent. For example:

- VertexCollection for Vertex components (on PolygonMeshes)

- ControlPointCollection for ControlPoint components (on NurbsCurveLists and NurbsSurfaceMeshes)

- EdgeCollection for Edge components (on PolygonMeshes)

- PolygonFaceCollection for PolygonFace components

- NurbsSurfaceCollection for subsurface (NurbsSurface) components (on NurbsSurfaceMeshes)

Note: If there is not an equivalent component collection, then an empty XSICollection is returned (for example, when a boundary or a knot is selected on a NurbsSurfaceMesh).

Examples

1. JScript Example

/*
        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

2. VBScript Example

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

See Also

PointCollection SegmentCollection FacetCollection NurbsCurveCollection