model.selection()
Named selections.
Syntax
model.selection().create(<tag>);
model.selection().create(<tag>,<type>);
model.selection(<tag>).model(<mtag>);
model.selection(<tag>).set(property,<value>);
model.selection(<tag>).geom(<gtag>,dim);
model.selection(<tag>).geom(<gtag>,highdim,lowdim,typelist);
model.selection(<tag>).geom(dim);
model.selection(<tag>).all();
model.selection(<tag>).set(<entlist>);
model.selection(<tag>).add(<entlist>);
model.selection(<tag>).remove(<entlist>);
model.selection(<tag>).inherit(bool);
 
model.selection(<tag>).model();
model.selection(<tag>).isGeom();
model.selection(<tag>).geom();
model.selection(<tag>).dimension();
model.selection(<tag>).entities(dim);
model.selection(<tag>).interiorEntities(dim);
model.selection(<tag>).isInheriting();
model.selection(<tag>).inputDimension();
model.selection(<tag>).inputEntities();
model.selection(<tag>).image();
Description
model.component(<ctag>).selection(<tag>) returns a named selection. Anywhere where you define a selection, you can point to a named selection by using its tag, for example, selection.named(<tag>.
model.component(<ctag>).selection().create(<tag>) creates a named selection of type Explicit.
model.component(<ctag>).selection().create(<tag>,<type>) creates a named selection of type <type>. The following types are available: "Explicit", "Union", "Intersection", "Difference", "Complement", "Adjacent", "Ball", "Box", "Cylinder", and "Disk".
model.selection(<tag>).model(<mtag>) sets  the model component node of the selection.
model.selection(<tag>).model() returns the model component node tag of the selection.
model.component(<ctag>).selection(<tag>).set(property,<value>) sets a property value for the selection. Which properties are available for the different selection types are listed on the following pages. All other assignment methods are only supported by the Explicit selection type.
Use the model.selection(<tag>).image() methods for plotting and exporting selection images. See Plotting and Exporting Images.
All other methods are explained in the section Selections.
Other entities can use any of the selections in model.component(<ctag>).selection() when defining its selection. For example, create a selection sel1:
model.component("comp1").selection().create("sel1");
Then, for example, a variable entities can use this selection:
model.component("comp1").variable().create("var1”);
model.component("comp1").variable("var1").model("mod1");
model.component("comp1").variable("var1").selection().named("sel1");
What properties are available depends on the type of selection. The following selection types are available:
Explicit
Selection defined by an explicit set of geometric entities such as domains or boundaries.
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
When groupcontang is set to on, the set, add, and remove methods operate on groups of adjacent entities that have continuous tangents at their junctions.
The angletol property defines the tolerance for the continuity evaluation.
Ball
Selection of entities that are inside or intersect a ball.
0 | 1 | 2 | 3
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
all | selections
intersects | inside | somevertex | allvertices
The posx, posy, and posz properties define the center of the ball, and r defines the radius. These properties take their units from the corresponding geometry sequence.
When condition is intersects, all entities that intersect the ball are included in the selection. The rendering mesh is used for the calculation. You can set the accuracy of the rendering mesh using
ModelUtil.setPreference("graphics.rendering.detail",<detail>);
where <detail> is coarse, normal, fine, or wireframe.
When condition is inside, all entities that are completely inside the ball are included in the selection. The rendering mesh is used for the calculation.
When condition is somevertex, all entities that have at least one adjacent vertex inside the ball are included in the selection.
When condition is allvertices, all entities that have all adjacent vertices inside the ball are included in the selection.
When inputent is selections, the selection is restricted to the entities in the selections defined by the input property. When inputent is all, all entities in the geometry are considered.
When groupcontang is set to on, the selection operates on groups of entities that have continuous tangents at their junctions.
The angletol property defines the tolerance for the continuity evaluation.
Box
Selection of entities that are inside or intersect a box.
0 | 1 | 2 | 3
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
all | selections
intersects | inside | somevertex | allvertices
The xmax, xmin, ymax, ymin, zmax, and zmin properties define the box. These properties take their units from the corresponding geometry sequence.
When condition is intersects, all entities that intersect the box are included in the selection. The rendering mesh is used for the calculation. You can set the accuracy of the rendering mesh using
ModelUtil.setPreference("graphics.rendering.detail",<detail>);
where <detail> is coarse, normal, fine, or wireframe.
When condition is inside, all entities that are completely inside the box are included in the selection. The rendering mesh is used for the calculation.
When condition is somevertex, all entities that have at least one adjacent vertex inside the box are included in the selection.
When condition is allvertices, all entities that have all adjacent vertices inside the box are included in the selection.
When inputent is selections, the selection is restricted to the entities in the selections defined by the input property. When inputent is all, all entities in the geometry are considered.
When groupcontang is set to on, the selection operates on groups of entities that have continuous tangents at their junctions.
The angletol property defines the tolerance for the continuity evaluation.
Cylinder
Selection of entities that are inside or intersect a cylinder in 3D.
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
0 | 1 | 2 | 3
intersects | inside | somevertex | allvertices
Direction of the cylinder axis. Vector has length 3 if axistype is cartesian and length 2 if axistype is spherical. Not used if axistype is x, y, or z.
x | y | z | cartesian | spherical
The pos property defines the center of the cylinder and the axis property defines the cylinder axis. The top, bottom, r, and rin properties define the size of the cylinder. Setting rin equal to r corresponds to a cylindrical surface. These properties take their units from the corresponding geometry sequence. Using the angle1 and angle2 properties, you can create a cylinder segment.
When condition is intersects, all entities that intersect the cylinder are included in the selection. The rendering mesh is used for the calculation. You can set the accuracy of the rendering mesh using
ModelUtil.setPreference("graphics.rendering.detail",<detail>);
where <detail> is coarse, normal, fine, or wireframe.
When condition is inside, all entities that are completely inside the cylinder are included in the selection. The rendering mesh is used for the calculation.
When condition is somevertex, all entities that have at least one adjacent vertex inside the cylinder are included in the selection.
When condition is allvertices, all entities that have all adjacent vertices inside the cylinder are included in the selection.
When inputent is selections, the selection is restricted to the entities in the selections defined by the input property. When inputent is all, all entities in the geometry are considered.
When groupcontang is set to on, the selection operates on groups of entities that have continuous tangents at their junctions.
The angletol property defines the tolerance for the continuity evaluation.
Disk
Selection of entities that are inside or intersect a disk.
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
0 | 1 | 2
all | selections
intersects | inside | somevertex | allvertices
The posx and posy properties define the center of the disk, and r and rin define the outer and inner radius, respectively. These properties take their units from the corresponding geometry sequence. Using the angle1 and angle2 properties, you can create a disk segment.
When condition is intersects, all entities that intersect the disk are included in the selection. The rendering mesh is used for the calculation. You can set the accuracy of the rendering mesh using
ModelUtil.setPreference("graphics.rendering.detail",<detail>);
where <detail> is coarse, normal, fine, or wireframe.
When condition is inside, all entities that are completely inside the disk are included in the selection. The rendering mesh is used for the calculation.
When condition is somevertex, all entities that have at least one adjacent vertex inside the disk are included in the selection.
When condition is allvertices, all entities that have all adjacent vertices inside the disk are included in the selection.
When inputent is selections, the selection is restricted to the entities in the selections defined by the input property. When inputent is all, all entities in the geometry are considered.
When groupcontang is set to on, the selection operates on groups of entities that have continuous tangents at their junctions.
The angletol property defines the tolerance for the continuity evaluation.
Union
Selection defined by the union of a set of selections.
0 | 1 | 2 | 3
Intersection
Selection defined by the intersection of a set of selections.
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
0 | 1 | 2 | 3
Difference
Selection defined by the difference between two sets of selections.
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
0 | 1 | 2 | 3
Complement
Selection defined by the complement of a set of selections.
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
0 | 1 | 2 | 3
Adjacent
Selection of entities that are adjacent to entities in another selection.
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
on | off
0 | 1 | 2 | 3
0 | 1 | 2 | 3
Examples
Define the selection equ1 as the domain of a rectangle and the selection bnd1 as the boundary of the rectangle.
Code for Use with Java
Model model = ModelUtil.create("Model");
model.component().create("comp1");
model.component("comp1").geom().create("geom1",2);
model.component("comp1").geom("geom1").create("f1","Rectangle");
model.component("comp1").geom("geom1").run("f1");
model.component("comp1").selection().create("equ1").geom(2);
model.component("comp1").selection("equ1").all();
model.component("comp1").selection().create("bnd1").geom(1);
model.component("comp1").selection("bnd1").all();
Code for Use with MATLAB
model = ModelUtil.create('Model');
model.component.create('comp1');
model.component('comp1').geom.create('geom1',2);
model.component('comp1').geom('geom1').create('f1','Rectangle');
model.component('comp1').geom('geom1').run('f1');
model.component('comp1').selection.create('equ1').geom(2);
model.component('comp1').selection('equ1').all;
model.component('comp1').selection.create('bnd1').geom(1);
model.component('comp1').selection('bnd1').all;
The (outer) boundaries for the model can be set with the following selection:
Code for Use with Java
Model model = ModelUtil.create("Model");
model.component().create("comp1");
model.component("comp1").geom().create("geom1",2);
model.component("comp1").geom("geom1").create("r1","Rectangle");
model.component("comp1").selection().create("outer").
      geom("geom1",2,1,new String[]{"exterior"});
model.component("comp1").selection("outer").all();
Code for Use with MATLAB
model = ModelUtil.create('Model');
model.component.create('comp1');
model.component('comp1').geom.create('geom1',2);
model.component('comp1').geom('geom1').create('r1','Rectangle');
model.component('comp1').selection.create('outer').geom('geom1',2,1,{'exterior'});
model.component('comp1').selection('outer').all;
Create a selection for all boundaries of a block intersecting a ball with radius 0.5 and center (1,1,1):
Code for Use with Java
Model model = ModelUtil.create("Model");
model.component().create("comp1");
model.component("comp1").geom().create("g1",3).create("blk1","Block");
model.component("comp1").geom("g1").run();
model.component("comp1").selection().create("ball1", "Ball");
model.component("comp1").selection("ball1").set("entitydim", "2");
model.component("comp1").selection("ball1").set("posx", "1");
model.component("comp1").selection("ball1").set("posy", "1");
model.component("comp1").selection("ball1").set("posz", "1");
model.component("comp1").selection("ball1").set("r", "0.5");
Code for Use with MATLAB
model = ModelUtil.create('Model');
model.component.create('comp1');
model.component('comp1').geom.create('g1',3).create('blk1','Block');
model.component('comp1').geom('g1').run;
model.component('comp1').selection.create('ball1', 'Ball');
model.component('comp1').selection('ball1').set('entitydim', '2');
model.component('comp1').selection('ball1').set('posx', '1');
model.component('comp1').selection('ball1').set('posy', '1');
model.component('comp1').selection('ball1').set('posz', '1');
model.component('comp1').selection('ball1').set('r', '0.5');
Create a selection of all edges adjacent to the boundaries in the ball selection:
Code for Use with Java
model.component("comp1").selection().create("adj1", "Adjacent");
model.component("comp1").selection("adj1").set("entitydim", "2");
model.component("comp1").selection("adj1").set("outputdim", "1");
model.component("comp1").selection("adj1").set("input", new String[]{"ball1"});
Code for Use with MATLAB
model.component('comp1').selection.create('adj1', 'Adjacent');
model.component('comp1').selection('adj1').set('entitydim', '2');
model.component('comp1').selection('adj1').set('outputdim', '1');
model.component('comp1').selection('adj1').set('input', {'ball1'});
See Also
Selections