create_distance#

Query.create_distance(name: str, query_type: str, part_list: List[Any], variable1: Any, variable2: Any | None = None, num_samples: int = 20, point1: List[float] | None = None, point2: List[float] | None = None, distance_type: str = 'arc_length', segments_by: str = 'accumulation', spline_name: str | None = None, new_plotter: bool = False) ENS_QUERY#

Create an EnSight query over a distance object.

Create an EnSight distance query using the passed parameters. Return the newly generated ENS_QUERY object.

Parameters:
namestr

Name for the query.

query_typestr

Type of the query. This table describes the options:

Name

Query type

DISTANCE_PART1D

Samples along the points of a 1D part

DISTANCE_LINE

Samples along the length of a line

DISTANCE_SPLINE

Samples along the length of a spline

part_list: list

List of parts to use as the source for the query. Part numbers, part names, and part objects are supported.

variable1

Variable to sample as the “y” value.

variable2optional

Variable to sample as the “x” value. The default is None, in which case the “x” value is the distance along the sampling domain.

num_samplesint, optional

For a spline or line query, the number of samples to use along the length of the spline or line. The default is 20.

point1list[float], optional

For a line query, the x,y,z location of the start of the line. The default is None.

point2:list[float], optional

For a line query, the x,y,z location of the end of the line. The default is None.

distance_typestr, optional

For a query over a distance (no second variable), how to compute distance. The default is "arc_length", in which case DIST-TYPE_LENGTH_X is used. This table describes the options:

Name

Query type

DIST_TYPE_LENGTH

Length along path

DIST_TYPE_LENGTH_X

X component along path

DIST_TYPE_LENGTH_Y

Y component along path

DIST_TYPE_LENGTH_Z

Z component along path

DIST_TYPE_ORIGIN

Distance from the origin

DIST_TYPE_ORIGIN_X

X component of distance from the origin

DIST_TYPE_ORIGIN_Y

Y component of distance from the origin

DIST_TYPE_ORIGIN_Z

Z component of distance from the origin

segments_bystr, optional

For a 1D part query, how to compute distance for the segments of the 1D part. The default is "accumulation", in which case DIST_SEG_ACCUMULATION is used. This table describes the options:

Name

Segment handling

DIST_SEG_ACCUMULATION

Accumulate distance over segments

DIST_SEG_RESET_EACH

Reset the distance value for each segment

spline_namestr, optional

For a spline query, the name of the spline to sample along. The default is None.

new_plotterbool, optional

Whether to add the query to a newly created plotter. The default is False.

Returns:
ENS_QUERY

ENS_QUERY instance on success or raises an exception on error.

Examples

>>> s = LocalLauncher().start()
>>> s.load_data(f"{s.cei_home}/ensight{s.cei_suffix}/data/cube/cube.case")
>>> parts = s.ensight.objs.core.PARTS["Computational mesh"]
>>> pnt1 = [-1.0, 0.5, 1.0]
>>> pnt2 = [2.0, 0.5, 1.0]
>>> query = s.ensight.utils.query.create_distance("Temperature vs Distance",
>>>             s.ensight.utils.query.DISTANCE_LINE, parts, "temperature",
>>>             point1=pnt1, point2=pnt2, new_plotter=True)