Filter (DataSourceCollection)

Description

Returns a subset of this collection as a new collection of objects matching the filter criteria. If no items are found, Filter returns "Nothing", which allows you to trap errors.

You can set up the filter criteria by using the 'Type', 'Families', and/or 'Path' parameters which roughly correspond to searching by type as outlined in the siType constant, searching by family as outlined in the siFamily constant, or searching by name of the object (see Object Name for more about valid syntax for the Path parameter).

Note: If you combine these parameters, they will narrow the scope of your search, not broaden it. For example, if you specify 'Nurbs Surface Mesh Geometries' (siNurbsSurfaceMeshFamily) for the Families parameter and 'Cone*' for the Path parameter, the return collection will contain any Nurbs cone that was in the original collection, but no Polygon Mesh cones and no Nurbs cubes, spheres, etc.

Scripting Syntax

DataSourceCollection.Filter( [Type], [Families], [Path] )

C# Syntax

DataSourceCollection DataSourceCollection.Filter( String in_filter, Object in_famArray, String in_path );

Parameters

Parameter

Type

Description

Type

String

siType (for example, "Model", "cube", "torus", etc.). Providing a type argument is equivalent to testing each object with the ProjectItem.IsKindOf method.

Default Value: Empty string

Families

siFamily or Array of siFamily values

Specifies the families that objects must belong to. To match the filter, an object must belong to at least one of the specified families.

Default Value: Empty Variant

Path

String

An Object Name. This can be a partial name using wildcards. For example, "a*" returns all matches that begin with the character "a".

Default Value: Empty string

Return Value

Collection of objects (subset of original collection).

Examples

• See DataSourceCollection.Filter.1.vbs

• See DataSourceCollection.Filter.2.pys

• See DataSourceCollection.Filter.3.js

• See DataSourceCollection.Filter.4.pys



Autodesk Softimage 2011