Module containing the different geometry objects.
- ansys.dpf.core.geometry.normalize_vector(vector)#
Normalize vector.
- class ansys.dpf.core.geometry.Points(coordinates, server=None)#
Collection of DPF points.
This can be a single point or a cloud of points.
- Parameters:
coordinates (array, list, Field) – Coordinates of the points in a 3D space.
server (
ansys.dpf.core.server
, optional) – Server with the channel connected to the remote or local instance. The default isNone
, in which case an attempt is made to use the global server.
Examples
Create Points object with two points, print object information and plot.
>>> from ansys.dpf.core.geometry import Points >>> points = Points([[0, 0, 0], [1, 0, 0]]) >>> print(points) DPF Points object: Number of points: 2 Coordinates: [0. 0. 0.] [1. 0. 0.] >>> points.plot()
- property coordinates#
Coordinates of the Points.
- property n_points#
Total number of points.
- property dimension#
Dimension of the Points object space.
- plot(mesh=None, **kwargs)#
Visualize Points object. If provided,
mesh
will be also plotted.
- 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 isNone
, 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()
- property coordinates#
Coordinates of the two points defining the line.
- property mesh#
Get line mesh.
- property length#
Get line length.
- property path#
Get line path (1D line coordinate).
- property n_points#
Get number of points for the line discretization.
- property direction#
Normalized direction vector between the two points defining the line.
- plot(mesh=None, **kwargs)#
Visualize line. If provided,
mesh
will be also plotted.
- class ansys.dpf.core.geometry.Plane(center, normal, width=1, height=1, n_cells_x=20, n_cells_y=20, server=None)#
Plane object.
- Parameters:
center (array, list) – 3D coordinates of the center point of the plane.
normal (array, list, Line) – Normal direction to the plane.
width (int, float) – Width of the discretized plane (default = 1).
height (int, float) – Height of the discretized plane (default = 1).
n_cells_x (int) – Number of cells in the x direction of the plane.
n_cells_y (int) – Number of cells in the y direction of the plane.
server (
ansys.dpf.core.server
, optional) – Server with the channel connected to the remote or local instance. The default isNone
, in which case an attempt is made to use the global server.
Examples
Create a plane from its center and normal direction, print object information and plot.
>>> from ansys.dpf.core.geometry import Plane >>> plane = Plane([0, 0, 0], [1, 0, 0]) >>> print(plane) DPF Plane object: Center point: [0, 0, 0] Normal direction: [1. 0. 0.] Plane discretizaton using: Width (x-dir): 1 Height (y-dir): 1 Num cells x-dir: 20 Num cells y-dir: 20 >>> plane.plot()
- property center#
Center of the plane.
- property normal_vect#
Normal vector to the plane.
- property normal_dir#
Normal direction to the plane.
- property mesh#
Get discretized mesh for the plane.
- property width#
Get width of the discretized plane.
- property height#
Get height of the discretized plane.
- property n_cells_x#
Get number of cells in the x direction of the plane.
- property n_cells_y#
Get number of cells in the y direction of the plane.
- plot(mesh=None, **kwargs)#
Visualize plane object. If provided,
mesh
will be also plotted.