selection Module

selection is a module for defining and using selections via Python. It provides a convenience layer to provide functionality provided by the underlying C++ classes.

A simple example:

from paraview.selection import *

# Create a new sphere proxy on the active connection and register it
# in the sources group.
sphere = Sphere(ThetaResolution=16, PhiResolution=32)

# Show the sphere
Show(sphere)

# Select cells falling inside a rectangle defined by two points on a diagonal,
# (300, 400) and (600, 800).
SelectSurfaceCells(Rectangle=[300, 400, 600, 800])

# Add cells on processor 0 with ids 1 and 2 to the current selection.
SelectIDs(IDs=[0, 1, 0, 2], FieldType='CELL', Source=sphere, Modifier='ADD')

# Remove cells on processor 0 with ids 4 and 5 from the current selection.
SelectIDS(IDs=[0, 4, 0, 5], FieldType='CELL', Source=sphere, Modifier='SUBTRACT')

# Extract the currently extracted cells
es = ExtractSelection()
Show(es)
paraview.selection.ClearSelection(Source=None)[source]

Clears the selection on the source passed in to the source parameter or the active source if no source is provided.

paraview.selection.QuerySelect(QueryString='', FieldType='POINT', Source=None, InsideOut=False)[source]

Selection by query expression. - QueryString - string with NumPy-like boolean expression defining which attributes are selected - FieldType - atttribute to select, e.g., ‘POINT’ or ‘CELL’ - Source - if not set, then the selection will be on the active source - InsideOut - Invert the selection so that attributes that do not satisfy the expression are

selected instead of elements that do

paraview.selection.SelectCellsThrough(Rectangle=[], View=None, Modifier=None)[source]

Select all cells within a rectangular region regardless of their visibility.

  • Rectangle - list containing bottom left (x1, y1) and top right (x2, y2) corner of a rectangle defining the selection region in the format [x1, y1, x2, y2]. Defined in pixels.

  • View - the view in which to perform the selection. If None, uses the current active view.

paraview.selection.SelectCompositeDataIDs(IDs=[], FieldType='POINT', ContainingCells=False, Source=None, Modifier=None)[source]

Select attributes by composite attribute IDs.

  • IDs - list of IDs of attribute types to select. Defined as 3-tuples of (flat block index, process number, attribute ID) interleaved in a single list.

  • FieldType - type of attribute to select, e.g., ‘POINT’, ‘CELL’

  • ContainingCells - if True and FieldType is ‘POINT’, select the cells containing the

    points corresponding to the given IDs.

  • Source - If not None, specifies the sources whose elements should be selected by ID.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection

    should modify the existing selection.

paraview.selection.SelectGlobalIDs(IDs=[], FieldType='POINT', ContainingCells=False, Source=None, Modifier=None)[source]

Select attributes by global IDs.

  • IDs - list of IDs of attribute types to select. Defined as a list of global IDs.

  • FieldType - type of attribute to select, e.g., ‘POINT’, ‘CELL’

  • ContainingCells - if True and FieldType is ‘POINT’, select the cells containing the

    points corresponding to the given IDs.

  • Source - If not None, specifies the sources whose elements should be selected by ID.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection

    should modify the existing selection.

paraview.selection.SelectHierarchicalDataIDs(IDs=[], FieldType='POINT', ContainingCells=False, Source=None, Modifier=None)[source]

Select attributes by hierarchical data IDs.

  • IDs - list of IDs of attribute types to select. Defined as 3-tuples of (level, index, attribute ID) interleaved in a single list.

  • FieldType - type of attribute to select, e.g., ‘POINT’, ‘CELL’

  • ContainingCells - if True and FieldType is ‘POINT’, select the cells containing the

    points corresponding to the given IDs.

  • Source - If not None, specifies the sources whose elements should be selected by ID.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection

    should modify the existing selection.

paraview.selection.SelectIDs(IDs=[], FieldType='POINT', ContainingCells=False, Source=None, Modifier=None)[source]

Select attributes by attribute IDs.

  • IDs - list of IDs of attribute types to select. Defined as (process number, attribute ID) pairs interleaved in a single list. For multiblock datasets, this will select attributes on all blocks of the provided (processor number, attribute ID) pairs

  • FieldType - type of attribute to select, e.g., ‘POINT’, ‘CELL’

  • ContainingCells - if True and FieldType is ‘POINT’, select the cells containing the

    points corresponding to the given IDs.

  • Source - If not None, specifies the sources whose elements should be selected by ID.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection

    should modify the existing selection.

paraview.selection.SelectLocation(Locations=[], Source=None, Modifier=None)[source]

Select points by location.

  • Locations - list of x, y, z points to select.

  • Source - if not set, then the selection will be on the active source

paraview.selection.SelectPedigreeIDs(IDs=[], FieldType='POINT', ContainingCells=False, Source=None, Modifier=None)[source]

Select attributes by Pedigree IDs.

  • IDs - list of IDs of attribute types to select. Defined as (domain, ID) pairs interleaved in a single list.

  • FieldType - type of attribute to select, e.g., ‘POINT’, ‘CELL’

  • ContainingCells - if True and FieldType is ‘POINT’, select the cells containing the

    points corresponding to the given IDs.

  • Source - If not None, specifies the sources whose elements should be selected by ID.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection

    should modify the existing selection.

paraview.selection.SelectPointsThrough(Rectangle=[], View=None, Modifier=None)[source]

Select all points within a rectangular region regardless of their visibility.

  • Rectangle - list containing bottom left (x1, y1) and top right (x2, y2) corner of a rectangle defining the selection region in the format [x1, y1, x2, y2]. Defined in pixels.

  • View - the view in which to perform the selection. If None, uses the current active view.

paraview.selection.SelectSurfaceBlocks(Rectangle=[], View=None, Modifier=None)[source]

Select visible blocks within a rectangular region.

  • Rectangle - list containing bottom left (x1, y1) and top right (x2, y2) corner of a rectangle defining the selection region in the format [x1, y1, x2, y2]. Defined in pixels.

  • View - the view in which to perform the selection. If None, uses the current active view.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection should modify the existing selection.

paraview.selection.SelectSurfaceCells(Rectangle=[], Polygon=[], View=None, Modifier=None)[source]

Select visible cells within a rectangular or polygon region.

  • Rectangle - list containing bottom left (x1, y1) and top right (x2, y2) corner of a rectangle defining the selection region in the format [x1, y1, x2, y2]. Defined in pixels. If not empty, the Polygon parameter must be empty or None.

  • Polygon - list of 2D points defining a polygon in which visible points should be selected,

    e.g., [x1, y1, x2, y2, …, xn, yn]. Defined in pixels. If not empty, the Rectangle parameter must be empty or None.

  • View - the view in which to perform the selection. If None, uses the current active view.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection should modify the existing selection.

paraview.selection.SelectSurfacePoints(Rectangle=[], Polygon=[], View=None, Modifier=None)[source]

Select visible points within a rectangular or polygon region.

  • Rectangle - list containing bottom left (x1, y1) and top right (x2, y2) corner of a rectangle defining the selection region in the format [x1, y1, x2, y2]. Defined in pixels. If not empty, the Polygon parameter must be empty or None.

  • Polygon - list of 2D points defining a polygon in which visible points should be selected,

    e.g., [x1, y1, x2, y2, …, xn, yn]. Defined in pixels. If not empty, the Rectangle parameter must be empty or None.

  • View - the view in which to perform the selection. If None, uses the current active view.

  • Modifier - ‘ADD’, ‘SUBTRACT’, ‘TOGGLE’, or None to define whether and how the selection should modify the existing selection.

paraview.selection.SelectThresholds(Thresholds=[], ArrayName='', FieldType='POINT', Source=None, Modifier=None)[source]

Select attributes in a source by thresholding on values in an associated array.

  • Thresholds - list of lower and upper threshold bounds. Attributes with associated values in the selected array between any set of bounds will be selected.

  • ArrayName - name of the array to threshold.

  • FieldType - atttribute to select, e.g., ‘POINT’ or ‘CELL’

  • Source - if not set, then the selection will be on the active source

class paraview.selection.SelectionProxy(**args)[source]

Bases: paraview.servermanager.Proxy

Special proxy wrapper type for Selections.