Line#

class ansys.dpf.core.geometry.Line(coordinates, n_points=100, server=None)#

Create Line object from two 3D points.

Parameters:
  • coordinates (array, list, Field, Points) – 3D coordinates of the two points defining the line.

  • n_points (int) – Number of points used to discretize the line (optional).

  • server (ansys.dpf.core.server, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Examples

Create a line from two points, print object information and plot.

>>> from ansys.dpf.core.geometry import Line
>>> line = Line([[0, 0, 0], [1, 0, 0]])
>>> print(line)
DPF Line object:
Starting point: [0. 0. 0.]
Ending point: [1. 0. 0.]
Line discretized with 100 points
>>> line.plot()

Overview#

plot

Visualize line. If provided, mesh will be also plotted.

coordinates

Coordinates of the two points defining the line.

mesh

Get line mesh.

length

Get line length.

path

Get line path (1D line coordinate).

n_points

Get number of points for the line discretization.

direction

Normalized direction vector between the two points defining the line.

__getitem__

Overwrite getitem so coordinates.data is iterable.

__len__

Overwrite len so it returns the number of points.

__str__

Print line information.

Import detail#

from ansys.dpf.core.geometry import Line

Property detail#

property Line.coordinates#

Coordinates of the two points defining the line.

property Line.mesh#

Get line mesh.

property Line.length#

Get line length.

property Line.path#

Get line path (1D line coordinate).

property Line.n_points#

Get number of points for the line discretization.

property Line.direction#

Normalized direction vector between the two points defining the line.

Method detail#

Line.__getitem__(value)#

Overwrite getitem so coordinates.data is iterable.

Line.__len__()#

Overwrite len so it returns the number of points.

Line.__str__()#

Print line information.

Line.plot(mesh=None, **kwargs)#

Visualize line. If provided, mesh will be also plotted.