On this page:
3.5.1 Command Line Entity Specification
3.5.2 Extended Command Line Entity Specification
3.5.3 Selecting Entities with the Mouse
3.5.3.1.1 Specifying the type of entity to select
3.5.3.1.2 Selecting the entities
3.5.3.6.1 The Selection Keyword
3.5.3.6.2 Echoing the ID of the Selection
3.5.3.6.3 Using the Picked Group in Commands
3.5.3.7.1 Creating and Modifying Selections
3.5.3.7.2 Rubberband Selection Control
3.5.4 Extended Selection Dialog
2021.11

3.5 Entity Selection And Filtering

Cubit Entity specification is a means of selecting objects or groups of objects. Entities can be selected from the command line using entity specification parameters, or directly in the graphics window using the mouse. This chapter describes these methods of entity selection.

3.5.1 Command Line Entity Specification

Cubit identifies objects in the geometry, mesh, and elsewhere using ID numbers and sometimes names. IDs and names are used in most commands to specify which objects on which the command is to operate.

These objects can be specified in Cubit commands in a variety of ways, which are best introduced with the following examples (the portion of each command which specifies a list of entities is shown in blue):

General ranges: Surface 1 2 4 to 6 by 2 3 4 5 Scheme Pave

Combined geometry, mesh, and genesis entities: Draw Sideset 1 Curve 3 Hex 2 4 6

Geometric topology traversal: Vertex in Volume 2 Size 0.3

Mesh topology traversal: Draw Edge in Hex 32}

All keyword: List Block all

Expand keyword: my_curve_group expand Scheme Bias Factor 1.5

Except keyword: List Curve 1 to 50 except 2 4 6

In addition to the examples above, there is an extended parsing capability that allows entities to be specified by a general set of criteria. See Extended Entity Specification for details. The following is a simple example of an extended entity specification:

By Criteria: Draw Curve With Length > 3

3.5.1.1 Types of Entity Range Input

The types of entity range input available in Cubit can be classified in 4 groups:

  1. General range parsing
    Entity IDs can be entered individually (volume 1), in lists (volume 1 2 3), in ranges (volume 3 to 7), and in stepped ranges (volume 3 to 7 step 2). The word all may also be used to specify all entities of a given type.

    An ID range has the form <start_id> to <end_id>. It represents each ID between start_id and end_id, inclusive.

    A stepped ID range has the form <start_id> To <end_id> {Step|By} <step>. It represents the set of IDs between start_id and end_id, inclusive, which can be obtained by adding some integer multiple of step to start_id. For example, 3 to 8 step 2 is equivalent to 3 5 7.

    The various methods of specifying IDs can be used together. For example:

    draw surface 1 2 4 to 6 vertex all

  2. Topological traversal
    Topological traversal is indicated using the "in" identifier, can span multiple levels in a hierarchy, and can go either up or down the topology tree. For example, the following entity lists are all valid:

    vertex in volume 3

    volume in vertex 2 4 6

    curve 1 to 3 in body 4 to 8 by 2

    If ranges of entities are given on both sides of the "in" identifier, the intersection of the two sets results. For example, in the last command above, the curves that have ids of 1, 2 or 3 and are also in bodies 4, 6 and 8 are used in the command.

    Topology traversal is also valid between entity types. Therefore, the following commands would also be valid:

    draw node in surface 3

    draw surface in edge 362

    draw hex in face in surface 2

    draw node in hex in face in surface 2

    draw edge in node in surface 2

  3. Exclusion
    Entity lists can be entered then filtered using the "except" identifier. This identifier and the ids following it apply only to the immediately preceding entity list, and are taken to be the same entity type. For example, the following entity lists are valid:

    curve all except 2 4 6

    curve 1 2 5 to 50 except 2 3 4

    curve all except 2 3 4 in surface 2 to 10

    curve in surface 3 except 2 (produces empty entity list!)

  4. Group expansion
    Groups in Cubit can consist of any number of geometry entities, and the entities can be of different type (vertex, curve, etc.). Operations on groups can be classified as operations on the group itself or operations on all entities in the group. If a group identifier in a command is followed immediately by the ‘expand’ qualifier, the contents of the group(s) are substituted in place of the group identifier(s); otherwise the command is interpreted as an operation on the group as a whole. If a group preceding the ‘expand’ qualifier includes other groups, all groups are expanded in a recursive fashion.

    For example, consider group 1, which consists of surfaces 1, 2 and curve 1. Surfaces 1 and 2 are bounded by curves 2, 3, 4 and 5. The commands in Table 1, illustrate the behavior of the ‘expand’ qualifier.

Table 1. Parsing of group commands; Group 1 consists of Surfaces 1-2 and Curve 1; Surfaces 1 and 2 are bounded by Curves 2-5.

Command

Entity list produced

Curve in Group 1

Curve 1

Curve in group 1 expand

Curves 1, 2, 3, 4, 5

The ‘expand’ qualifier can be used anywhere a group command is used in an entity list; of course, commands which apply only to groups will be meaningless if the group id is followed by the ‘expand’ qualifier.

3.5.1.2 Precedence of "Except" and "In"

Several keywords take precedence over others, much the same as some operators have greater precedence in coding languages. In the current implementation, the keyword "Except" takes precedence over other keywords, and serves to separate the identifier list into two sections. Any identifiers following the "Except" keyword apply to the list of entities excluded from the entities preceding the "Except". Table 2 shows the entity lists resulting from selected commands.

Table 2. Precedence of "Except" and "In" keywords; Group 1 consists of Surfaces 1-2 and Curve 1.

Command

Entity list produced

Curve all except 1 in Group 1

(All curves except curve 1)

Curve all except 2 3 4 in Surf 2 to 10

(All curves except 2, 3, 4)

In the first command, the entities to be excluded are the contents of the list "[Curve] 1 in Group 1", that is the intersection of the lists "Curve 1" and "Curve in Group 1"; since the only curve in Group 1 is Curve 1, the excluded list consists of only Curve 1. The remaining list, after removing the excluded list, is all curves except Curve 1.

In the second command, the excluded list consists of the intersection of the lists "Curve 2 3 4" and "Curve in Surf 2 to 10"; this intersection turns out to be just Curves 2, 3 and 4. The remaining list is all curves except those in the excluded list.

3.5.1.3 Placement in Cubit Commands

In general, anywhere a range of entities is allowed, the new parsing capability can be used. However, there can be exceptions to this general rule, because of ambiguities this syntax would produce. Currently, the only exception to this rule is the command used to define a sideset for a surface with respect to an owning volume.

3.5.2 Extended Command Line Entity Specification

In addition to basic entity specification, entities may be specified using an extended expression. An extended expression identifies one or more entities using a set of entity criteria. These criteria describe properties of the entities one wishes to operate upon.

3.5.2.1 Extended Parsing Syntax

The most common type of extended parsing expression is in the following format:

{Entity_Type With {Criteria}}

Entity_Type is the name of any type of entity that can be used in a command, such as Curve, Hex, or SideSet. Criteria is a combination of entity properties (such as Length), operators (such as >=), keywords (such as Not), and values (such as 5.3) that can be evaluated to true or false for a given entity. Here are some examples:

curve with length <1 surface with is_meshed = false node with x_coord > 10 And y_coord > 0

3.5.2.2 Keywords

These are the keyword defined by extended parsing

Keyword

Description

all, to, step, by, except, in, common_to, expand, include

These keywords are used the same way as in basic entity specification. For example:

draw surface all

draw surface 1 to 5 step 2 curve 1 to 3 in body 4 to 8 by 2

draw hex in face in surface 2

draw face common_to volume 1 2

draw node in hex in face in surface 2 curve 1 2 5 to 50 except 2 3 4

draw volume 10 include similar

not

Not flips the logical sense of an expression - it changes true to false and false to true. For example:

draw surface with not is_meshed

of

The "of" operator is used to get an attribute value for a single entity, such as "length of curve 5". Only attributes that return a single numeric value may be used in an "of" expression. There must be only one entity specified after the "of" operator, but it can be identified using any valid entity expression. An example of a complete command which includes the "of" operator is:

list curve with length < length of curve 5 ids

and, or

These logic operators determine how multiple criteria are combined.

draw surface with length > 3 or with is_meshed = false

< > <= >= = <>

These relational operators compare two expressions. You may use = or == for "equals". <> means "not equal". For example:

draw surface with x_max <= 3

draw volume with z_max <>12.3

+ - * /

These arithmetic operators work in the traditional manner.

draw surface with length * 3 + 1.2 > 10

( )

Parentheses are used to group expressions and to override precedence. When in doubt about precedence, use parentheses.

draw surface with length > 3 and ( with is_meshed = false or x_min > 1 )

3.5.2.3 Functions

The following functions are defined. Not all functions apply to all entities. If a function does not apply to a given entity, the function returns 0 or false.

Keyword

Description

ID

the ID of an entity

length

The length of a curve or edge

area

The area of a surface.

volume

The volume of a volume.

exterior_angle

Works for curves with an exterior angle greater than (>), less than (<), or equal to (=) a given angle in degrees. This is used if you want to do some operation, such as refinement, on all the reentrant curves or curves with surfaces that form a certain angle.

radius

Radius of an arc or blend surface.

is_meshed

Whether a geometric entity has been meshed or not

is_spline

Whether a geometric entity is defined using a NURBS representation. Otherwise the entity has an analytic representation.

is_blend

Whether a geometric surface is a blend. Blends have a constant principal radius of curvature and meet two or more adjoining surfaces at an angle of approximately 180 degrees. "Fillets" are examples of blend surfaces.

is_plane

Whether a geometric surface is planar.

is_periodic

Whether a geometric surface is periodic, such as a sphere or torus.

is_sheetbody

A geometric entity is a sheetbody if it is a collection of surfaces that do not form a solid.

element_count

The number of elements owned by this geometric entity. Only elements of the same dimension as the entity are counted (number of hexes in a volume, number of faces on a surface, etc.)

dimension

The topological dimension of an entity (3 for volumes, 2 for surfaces, etc.).

X_coord, Y_coord, Z_coord

The x, y, or z coordinate of the point at the center of the entity’s bounding box.

X_min, Y_min, Z_min

The x, y, or z coordinate of the minimum extent of the entity’s bounding box

X_max, Y_max, Z_max

The x, y, or z coordinate of the maximum extent of the entity’s bounding box

is_merged

Whether a geometry entity has a merge flag on. All geometric entities have one set by default.

is_virtual

A flag that specifies whether an entity is virtual geometry. An entity is virtual if it has at least one virtual (partition/composite) topology bridge.

has_virtual

An entity "has_virtual" if it is virtual itself, or has at least one child virtual entity

is_real

An entity "is_real" if it has at least one real (non-virtual) topology bridge.

num_parents

Used to specify geometry entities with a specified number of parent entities. May be used to find "free curves" where num_parents=0 or non-manifold curves where num_parents>2.

is_free

Used to specify geometry entities without parent entities. May be used to find free curves and vertices where num_parents=0 or free surfaces that do not form a solid (sheet bodies).

block_assigned

Used to specify elements which have been assigned to a block. This is also useful to find elements NOT assigned to a block by using "not block_assigned".

has_scheme

Used to specify geometry entities which have been assigned a specified scheme. The scheme name is specified with the keyword string used when setting the scheme. Wildcards can also be used when specifying the scheme name. For example, draw surface with has_scheme ’*map’ will draw surfaces with scheme map or submap.

similar

Used with the include keyword. Compares a list of geometry entities and adds additional entities that are classified as similar. Implemented for curves, surfaces and volumes. Similar is defined as the same geometric length, area or volume using a tolerance of 0.1 percent, as well as the same number of child entities. For example, "draw volume 10 include similar" will draw all volumes with the same geometric volume and number child surfaces as volume 10.

cavity

Used with the include keyword. Compares a list of surface entities and adds additional adjacent surfaces that are part of the same cavity. Implemened only for surfaces. A cavity is defined as the collection of surfaces bounded by curves where the exterior angle is greater than 180 degrees. For example, "draw surface 10 include cavity" will draw surface 10 along with the cavity to which it belongs.

blend_chain

Used with the include keyword. Compares a list of surface entities and adds additional adjacent surfaces that are part of the blend_chain. Implemened only for surfaces. A blend_chain is defined as the collection of attached surfaces that have the same minimum radius of curvature. For example, "draw surface 10 include blend_chain" will draw surface 10 along with the blend_chain to which it belongs.

continuous

Used with the include keyword. Compares a list of surface entities and adds additional adjacent surfaces that are part of a collection of continuous surfaces. Implemened only for surfaces. Continuous surfaces are defined as the collection of attached surfaces that are bounded by curves where the exterior angle is approximately 180 degress (tolerance = 15 degrees). For example, "draw surface 10 include continuous" will draw surface 10 along with other surfaces within the same continuous collection.

3.5.2.4 Precedence

For complicated expressions, which entities are referred to is influenced by the order in which portions of the expression are evaluated. This order is determined by precedence. Operators with high precedence are evaluated before operators with low precedence. You may always include parentheses to determine which sub-expressions are evaluated first. Here all operators and keywords listed from high to low precedence. Items listed together have the same precedence and are evaluated from left to right.

(, ) Expand Not *, / +, - <, >, <=, >=, <>, = And, Or Except In Of With

Because of precedence, the following two expressions are identical:

curve with length + 2 * 2 > 10 and length <= 20 in my_group

expand(curve with (((length + (2*2)) > 10 )and( length <= 20 ))) in ( my_group expand )

3.5.3 Selecting Entities with the Mouse

The following discussion is applicable only to the command line version of Cubit. See GUI Entity Selection for a description of interactive entity selection with the Graphical User Interface. Also refer to Extended Selection Dialog to learn how to use Python scripts to create extensive selection capabilities.

Many of the commands in Cubit require the specification of an entity on which the command operates. These entities are usually specified using an object type and ID (see Entity Specification) or a name. The ID of a particular entity can be found by turning labels on in the graphics and redisplaying; however, this can be cumbersome for complicated models. Cubit provides the capability to select with the mouse individual geometry or mesh entities. After being selected, the ID of the entity is reported and the entity is highlighted in the scene. After selecting the entities, other actions can be performed on the selection. The various options for selecting entities in Cubit are described below, and are summarized in Table 1:

Table 1. Picking and key press operations on the picked entities

Key

Action

ctrl + B1

Pick entity of the current picking type.

shift + ctrl + B1

Add picked entity of the current picking type to current picked entity list.

tab

Query-pick; pick entity of current picking type that is below the last-picked entity.

n

Lists what entities are currently selected.

l

Lists basic information about each selected entity. This is similar to entering a List command for each selected entity.

g

Lists geometric information about the selection. As if the List Geometry command were issued for each entity. If there are multiple entities selected, a geometric summary of all selected entities is printed at the end, including information such as the total bounding box of the selection.

i

Makes the current selection invisible. This only affects entities that can be made invisible from the command line (i.e. geometric and genesis entities.)

s

Draws a graphical scale showing model size in the three coordinate axes. This is a toggle action, so pressing the ’s’ key again in the graphics window will turn the scale off.

ctrl + z

Zoom in on the current selection.

e

Echo the ID of the selection to the command line.

a

Add the current selection to the picked group. Only geometry will be added to the group (not mesh entities). If a selected entity is already in the picked group, it will not be added a second time.

r

Remove the current selection from the picked group. If a selected entity was not found in the picked group, this command will have no effect.

ctrl + r

Redisplays the model.

c

Clear the picked group. The picked group will be empty after this command.

m

Lists what entities are currently in the picked group.

d

Display and select the entities in the picked group.

ctrl + d

Draws the entity that is selected.

3.5.3.1 Entity Selection
3.5.3.1.1 Specifying the type of entity to select

Clicking on the scene can be interpreted in more than one way. For example, clicking on a curve could be intended to select the curve or a mesh edge owned by that curve. The type of entity the user intends to select is called the picking type. In order for Cubit to correctly interpret mouse clicks, the picking type must be indicated. This can be done in one of two ways. The easiest way to change the picking type is to place the pointer in the graphics window and enter the dimension of the desired picking type and an optional modifier key. The dimension usually corresponds to the dimension of the objects being picked:

Table 2. Picking Modes in Graphics Window

Number

Default pick

Number +shift pick

0

vertices

nodes

1

curves

edges

2

surfaces

all 2D elements

3

volumes

all 3D elements

4

bodies

If a Shift modifier key is held while typing the dimension, the picking type is set to the mesh entity of corresponding dimension, otherwise the geometry entity of that dimension is set as the picking type. For example, typing 2 while the pointer is in the graphics window sets the picking type so that geometric surfaces are picked; typing Shift-1 sets the picking type so that mesh edges are picked. To differentiate between picking "tris" or "quads" use "pick face" or "pick tri"}

The picking type can also be set using the command

Pick <entity_type>

where entity_type is one of the following: Body , Volume , Surface , Curve , Vertex , Hex , Tet , Face , Tri , Edge , Node , or DicerSheet .

3.5.3.1.2 Selecting the entities

To select an object, hold down the control key and click on the entity (this command can be mapped to a different button and modifiers, as described in the section on Mouse-Based View Navigation). Clicking on an entity in this manner will first de-select any previously selected entities, and will then select the entity of the correct type closest to the point clicked. The new selection will be highlighted and its name will be printed in the command window.

3.5.3.2 Query Selection

If the highlighted entity is not the object you intended to selected, press the Tab key to move to the next closest entity. You can continue to press tab to loop through all possible selections that are reasonably close to the point where you clicked. Shift-Tab will loop backwards through the same entities.

3.5.3.3 Multiple Selected Entities

To select an additional entity, without first clearing the current selection, hold down the shift and control keys while clicking on an object. You can select as many objects as you would like. By changing the picking type between selections, more than one type of entity may be selected at a time. When picking multiple entities, each pick action acts as a toggle; if the entity is already picked, it is "unpicked", or taken out of the picked entities list.

3.5.3.4 Information About the Selection

When an entity is selected, its name, entity type, and ID are printed in the command window. There are several other actions which can then be performed on the picked entity list. These actions are initiated by pressing a key while the pointer is in the graphics window. Table 1 summarizes the actions which operate on the selected entities.

3.5.3.5 Picked Group

There is a special group whose contents can be altered using picking. This group is named picked , and is automatically created by Cubit. Other than its relationship to interactive picking, it is identical to other groups and can be operated on from the command line. Like other groups, both geometric and mesh entities can be held in the picked group. Table 1 lists the graphics window key presses used with the picked group.

It is important to distinguish between the current selection and the picked group contents. Clicking on a new entity will select that entity, but will not add it to the picked group. De-selecting an entity will not remove an entity from the picked group.

3.5.3.6 Substituting Selection into Other Commands
3.5.3.6.1 The Selection Keyword

You may refer to all currently selected entities by using the word selection in a command; the picked type and ID numbers of all selected entities will be substituted directly for selection . For example, if Volume 1 and Curve 5 are currently selected, typing

Color selection Blue

is identical to typing

Color Volume 1 Curve 5 Blue

Note that the selection keyword is case sensitive, and must be entered as all lowercase letters.

3.5.3.6.2 Echoing the ID of the Selection

Typing an e into a graphics window will cause the ID of each selected entity to be added to the command line at the current insertion point. This is a convenient way to use entities of which you don’t already know the name or ID.

As an added convenience, the picking type can be set based on the last word on the command line using the ‘ key. Note that this is not the apostrophe key, but rather the left tick mark, usually found at the upper-left corner of the keyboard on the same key as the tilde (~). For example, a convenient way to set the meshing scheme of a cylinder to sweep would be as follows:

Volume (hit ‘, select cylinder, hit e) Scheme Sweep Source Surface (hit ‘, select endcap, hit e) Target (select other endcap, hit e)

The result will be something similar to

Volume 1 Scheme Sweep Source Surface 1 Target 2

Notice that you must use the word Surface in the command, or ‘ will not select the correct picking type.

3.5.3.6.3 Using the Picked Group in Commands

Like other groups, the picked group may be used in commands by referring to it by name. The name of the picked group is picked. For example, if the contents of the picked group are Volume 1 and Volume 2, the command

Draw picked

is identical to

Draw Volume 1 Volume 2

Note that picked is case sensitive, and must be entered as all lowercase letters.

3.5.3.7 Select Commands
3.5.3.7.1 Creating and Modifying Selections

The following commands may be used to create a new selection or modify the current selection.

Select <entity_list> [add|remove]

This command selects the specified entities. If the add option is specified, the entities are added to the current selection. If the remove option is specified, the entities are removed from the current selection. If neither is specified, the current selection is replaced with the specified entities.

Select None

This command clears the selection.

Select Seed {face <ids>|tri <ids>} feature_angle <angle>

This command creates a new selection based on a seed face and feature angle. It finds all the neighboring faces with a feature angle that is less than the specified angle and adds them to the selection.

3.5.3.7.2 Rubberband Selection Control

The following commands control the behavior of rubberband selection.

Select Occluded {on|off}

When turned on, the selection will include entities that are occluded, or hidden behind other entities, in the current graphics view.

Select Partial {on|off}

When turned on, the selection will include all entities that touch the rubberband. When turned off, the selection will include only entities that lie completely within the rubberband region.

Select Rubberband Shape {box|polygon|circle}

Choose the rubberband shape to be box, polygon, or circle. If polygon is selected, the shape of the polygon is defined by the left mouse button clicks in the graphics windows. To end defining the polygon shape and make the selection, click the right mouse button.

3.5.4 Extended Selection Dialog

Selecting entities in the graphics window can sometimes be complicated. The Extended Selection Dialog (introduced in Cubit 16.0) leverages the combination of http://www.python.org and the CubitInterface class to give users a very powerful mechanism for creating and managing custom selection filters.

3.5.4.1 Accessing the Dialog

The dialog is accessible any time a geometry entity is selected in the graphics window. Consider this workflow:

3.5.4.1.1 Launch the Dialog

Figure 80:

When the dialog is first shown, no filters are available.

3.5.4.1.2 Load Existing Filters

Load existing filters by:

Figure 81:

The very first time this dialog is shown, the path to the filters folder will be blank and no filters will be shown in the filter list. Press the "Browse" button and select the folder that contains the custom filters. This folder can be anywhere on the file system. Cubit will remember the location and use it during subsequent sessions. The folder may be changed at any time.

A list of custom filters, written in Python, will be shown. Select any given filter to examine its contents. Check all filters to be included in the menu for Extended Filters. Then press "OK".

Figure 82:

At this point, all of the filters selected in the Locate and Load Filters dialog will be available for use in the Extended Selection dialog.

Figure 83:

3.5.4.1.3 Use a Filter

Use the pull down menu to select a filter. Click on an entity in the Source Selection list. Geometric entities that fit the filter criterion will be shown in the Target Entities list.

Figure 84:

  • Make selections in the Target Entities list.

  • If a pickwidget is active selected IDs will be copied into the pickwidget

  • Access the context menu in the Target Entities list for other options, including copying entity names or IDs to the clipboard.

Figure 85:

3.5.4.1.4 Dragging from Target Entities to Source Selection

Depending on the nature of the selection filter it may be useful to ’re-seed’ the Source Selection with an item from Target Entities. Simply drag an item or items from Target Entities into the Source Selection list.

3.5.4.2 Creating Parameterized Filters

Beginning with Cubit 16.1.2 users are able to create and use extended selection filters that contain input fields. In other words, selection filters may be parameterized.

Filters of this type will require a user interface which will be added into the extended selection filter dialog. The user interface can be made using Qt’s Designer, which is a free tool that ships with the Qt toolkit. The Qt Designer tool produces a XML file that will be read by Cubit and automatically included in the filter dialog.

For example, if we wanted to create a selection filter that would select all entities of a certain type within a certain radius of a source entity, we would require a user interface that captures the desired radius and the desired entity type to be selected. An image of that user interface is shown below. The image was copied directly from Qt Designer.

Figure 86:

Notice two input fields: 1) a Line Edit to capture the desired selection radius and 2) a Combo Box that contains "Volumes", "Surfaces", "Curves", "Vertices" to specify the target entity selection type. The extended selection filter that contains this custom interface is shown below. The example shows a selection of all curves within 1 unit of the source selection.

Figure 87:

3.5.4.3 
3.5.4.4 Writing Custom Python Filters

The class CubitInterface is used by the Cubit GUI to drive Cubit and access its database. You can read about the Python Interface used by Cubit for more details. Suffice to say, all of the functions and data included in CubitInterface are available to Python programmers.

Extended Selection custom filters are written in Python. Follow the instructions below, save the filters on the file system, then load the filters as explained above.

3.5.4.4.1 A Simple Example Filter

This first example shows a filter that will return a list of first generation children of the selected entities. No user input is required and no additional user interface is necessary.

Figure 88:

  • The filter’s File Name and Class Name must match. In this example, the file name is ChildFilter.py and the class name is "ChildFilter".

  • LINE 2: import cubitgui – this is the Python module that owns the base class (SelectionFilter) from which this filter class is derived.

  • LINE 3: import cubit – this is the Python module that grants access to all of the CubitInterface functions.

  • LINE 6: When defining the class do the following:

    • Ensure the class name matches the file name

    • Derive the class from cubitgui.SelectionFilter

  • LINE 9: Implement the ’virtual’ function "display_name". Return a string that represents the name of the filter. It is this name that will be shown in the Extended Selection dialog’s filter menu.

  • LINE 13: Implement the ’virtual’ function "run_filter. This is the actual filter.

  • LINE 15: The function get_source_types() returns a list of the types selected in the "Source Selection" list of the Extended Selection dialog.

  • LINE 16: The function get_source_ids() returns a list of the ids selected in the "Source Selection" list of the Extended Selection dialog.

  • LINE 17: The function clear_target_selections() clears the Target Entities list of the Extended Selection dialog.

  • LINE 18: The example filter begins manipulating data to suit its needs

  • LINE 35: The function get_relatives(...) is a member of CubitInterface. It returns a list of ids of a specified type

  • LINE 37: The function add_target_selection(<type> <id>) adds one instance of an entity-type/id to the Target Entities list.

3.5.4.4.2 The Selection Filter Class

As mentioned above, the custom Python filters must implement a class and that class must be derived from the SelectionFilter class. The SelectionFilter class is available in the Cubit SDK. The SDK is available at no charge to any Cubit user.

3.5.4.4.3 A Sample Filter that Includes Additional User Interface

In order to include user input into an extended selection dialog, two additional things must happen:

1) The developer must create the user interface definition file (.ui file) using Qt Designer;

2) An additional function must be implemented in the class definition of the Python filter. The additional function is called get_ui_file().

Qt UI objects supported by the extended selection filter include:

1) QLineEdit - std::string get_line_edit_value ( object-name )

2) QComboBox - std::string get_combo_box_value( object-name )

3) QRadioButton - bool get_radio_button_value( object-name )

4) QCheckBox - bool get_check_box_value(object-name )

5) QSpinBox - int get_spin_box_value(object-name )

6) QSlider - int get_slider_value(object-name )

As the example Python code shows, the Qt objects are referenced by name. These code snippets below are not complete. Complete examples and a video tutorial are available from http://www.coreform.com. Detailed training is also available upon request.

"

Figure 89:

"

Figure 90: