The named selection worksheet defines the criteria from which to generate a selection. Each row of the worksheet adds a new criteria and defines the relationship with the previous rows. The focus here is on adding a new row.
The NamedSelectionCriteria
object behaves like a list and
has standard list properties and methods including Add()
,
Clear()
, Count
,
Insert
, Remove
, and a [] indexer.
You can use the Add()
method to add a NamedSelectionCriterion, which is the object for each element in the
list and controls the data of a single row in the worksheet.
To add the first criterion to your worksheet:
pipews.Add(None) pipews[0].EntityType=SelectionType.GeoBody pipews[0].Criterion=SelectionCriterionType.Size pipews[0].Operator=SelectionOperatorType.GreaterThan pipews[0].Value=Quantity("3.8e-5 [m m m]") sel.Generate()
This example defines a criterion to select bodies with a size value greater than 3.8e-5.

The method Generate
on the
NamedSelection
object generates the selection based on
the criteria. After executing this method, observe that the pipe body is selected in
the Graphics view. In the Details view,
the property Total Selection is set to 1
Body.

Next, you can add another criteria to include other bodies:
pipews.Add(None) pipews[1].EntityType=SelectionType.GeoBody pipews[1].Criterion=SelectionCriterionType.Distance pipews[1].Operator=SelectionOperatorType.LessThan pipews[1].Value=Quantity("3.8e-6 [m]") sel.Generate()
This new criteria is defined to select bodies whose distance from a given coordinate system is less than 3.8e-6. If you do not specify a coordinate system, it defaults to the global coordinate system.

After executing the Generate
method, observe that the bolt
body is now selected in the Graphics view, along with the pipe
body. In the Details view, the property Total
Selection is set to 2 Bodies.
