poISelectionSet Add

Adds entities to the selection set.

Syntax

selectionSet_handle Add <PoolName> selection

Note: PoolName only applies to: id, idlist, selectionset, MaxofSet, and MinofSet.

If the <PoolName> is not specified, then the User_Set pool is considered the default.

Application

HyperView Tcl Modify

Description

This command adds entities specified by the argument selection to the current selection set (for example, Add "id 1", Add "id = 1").

Inputs

selection
To see a detailed list of possibilities use the GetSelectByList command on the selection set (and also take a look at the list and examples below):
"id"
Selects entities based on a single id or range of ids. IDs can also be selected using operators like: <, <=, >, >=.
"idlist"
Comma separated list of IDs and ID ranges. IDs can also be selected using operators like: <, <=, >, >=.
"all"
Selects all of the entities and adds them to the set. The entities that are added depend upon the SetSelectMode flag.
"displayed"
Selects the displayed entities and adds them to the set.
"component"
Selects entities belonging to a component id.
"component_name"
Selects entities belonging to a component name.
"contour"
Selects entities based on a contour value. The contour value can also be combined with operators like <, <=, >, >=, as well as keywords like "Top N", "Bottom N", "MaxofSet", and "MinofSet" (see the contour section of the example below).
"selectionset"
Selects entities base on another selection set.
"sphere"
Selects entities which lie inside the specified sphere center and radius.
"adjacent"
Selects entities which are adjacent to the existing entities in the set. One layer of adjacency is used.
"attached"
Selects entities which are attached to the existing entities in the set. This selects all of the entities recursively until no attached entities are found.
"dimension"
Selects entities based on a specified dimension (for example, 1d elements, 2d elements, or 3d elements).
"config"
Selects elements based on the element configuration. For example, "config 103" means tria elements. This configuration matches with the HyperMesh configuration. The following configurations are available in HyperView:
1D
1-MASS; 2-PLOT; 3-WELD; 5-RIGID; 21-SPRING; 22-JOINT; 55-RIGIDLINK; 56-RBE3; 60-BAR; 61-ROD; 63-BAR3; 70-GAP
2D
103-TRIA3; 104-QUAD4; 106-TRIA6; 108-QUAD8
3D
204-TETRA4; 205-PYRAMID5; 206-PENTA6; 208-HEX8; 210-TETRA10; 213- PYRAMID13; 215-PENTA15; 220-HEX20;
"face"
Selects entities on the face of the entities that are already selected in the current selection set. This rule assumes that there is at least one entity already existing in the set.
"plane"
Selects entities on a plane with a given normal direction, base point coordinates and a tolerance value.

In addition to these rules, a Reverse rule can be used for appropriate entities which will reverse the current selection in the set. Please follow its usage in the example.

Example

To create a selection set for nodes and use Add to demonstrate some of the possible selections:
hwi OpenStack
hwi GetSessionHandle session_handle
session_handle GetProjectHandle project_handle
project_handle GetPageHandle page_handle [project_handle GetActivePage]
page_handle GetWindowHandle window_handle [page_handle GetActiveWindow]
window_handle GetClientHandle client_handle
client_handle GetModelHandle model_handle [client_handle GetActiveModel]

model_handle GetSelectionSetHandle selection_set_handle [model_handle AddSelectionSet node]
selection_set_handle SetLabel "OurNodeSelectionSet"
puts "Possible list selections: [selection_set_handle GetSelectByList]"

selection_set_handle Clear
selection_set_handle Add all
puts "Add all : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add node with a particular ID
selection_set_handle Clear
selection_set_handle Add "id 1"
#if your model has different pools use the following command 
#and replace poolName with your pool name
#set poolName "MyPoolName"; selection_set_handle Add "$poolName id 1"
puts "Add id 1 : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add nodes in the ID range of 1 to 100
selection_set_handle Clear
selection_set_handle Add "id 1-100"

#add nodes in the ID range of 101 to 200 and 205 to 300 from poolName
set poolName "MyPoolName";
selection_set_handle Add "$poolname idlist 101-200, 205-300"

puts "Add id 1-100 : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add all nodes in the specified component-ID range (1-100)
#add assembly uses the same syntax as add component
selection_set_handle Clear
selection_set_handle Add "component 1-100"
puts "Add component 1-100 : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add all nodes on the specified component, 
#replace compName by your component name
set compName component1
selection_set_handle Clear
selection_set_handle Add "component == $compName"
puts "Add nodes on component $compName : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add all nodes with a contour value above 0.0 
selection_set_handle Clear
selection_set_handle Add "contour > 0.0"
puts "Add contour value above 0 : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add entities from another selectionset of a given poolName
selection_set_handle Clear

model_handle GetSelectionSetHandle selection_set_handle2 [model_handle AddSelectionSet node]; selection_set_handle2 Add "id 1-100"

selection_set_handle Add "<poolName> selectionset == [selection_set_handle2 GetID] "
#if <poolName> is not specified, then the selection will be done from the User_set pool as default

puts "Add another selection set : [selection_set_handle GetSize] [selection_set_handle GetType]s"
selection_set_handle2 ReleaseHandle

#add all nodes inside a defined sphere
selection_set_handle Clear
set x 247.5; set y 327.1; set z 574.5; set radius 1.2
selection_set_handle Add "sphere $x $y $z $radius"
puts "Add nodes in defined shpere : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add all nodes adjacent to the current selection
selection_set_handle Clear
selection_set_handle Add "id 1 "
puts "Add node with id 1 : [selection_set_handle GetSize] [selection_set_handle GetType]s"
selection_set_handle Add "adjacent"
puts "Add all adjacent nodes : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#add all nodes attached to the current selection
selection_set_handle Clear
selection_set_handle Add "id 1 "
puts "Add node with id 1 : [selection_set_handle GetSize] [selection_set_handle GetType]s"
selection_set_handle Add "attached"
puts "Add all attached nodes : [selection_set_handle GetSize] [selection_set_handle GetType]s"


#add all nodes attached to elements of the defined dimension
#examples for dimension: 1(beams,bars), 2(shells),3(solids), 0(mass elements)
selection_set_handle Clear
selection_set_handle Add "dimension 2"
puts "Add nodes attached to 2D elements : [selection_set_handle GetSize] [selection_set_handle GetType]s"

#to find the top 10 or bottom 10 entities from the contour plot
selection_set_handle Clear
selection_set_handle Add "contour top 10"
selection_set_handle Add "contour bottom 10"

#to find entities with contour values greater than or less than certain values
selection_set_handle Add "contour > 50"
selection_set_handle Add "contour < 0.5"

#to find entity with maximum and minimum contour value from the given entity set under poolName
set poolName "MyPoolName";
selection_set_handle Add "$poolname contour maxofset <set_id>"
selection_set_handle Add "$poolname contour minofset <set_id>"

# Add entities intersecting a plane whose normal is X-axis and the base point is -642, 23, -339 with a tolerance value of 1.0
selection_set_handle Add "plane 1.0 x -642 23 -339"

# Select entities by face
# This command assumes there is atleast one entity already existing in the set
selection_set_handle Add "face"


# Reverse rule is not a part of Add
# You simply call Reverse API on the set handle
selection_set_handle Reverse

hwi CloseStack

Errors

This command should not return any errors. If the argument is invalid, nothing is added to the selection set.