Skip to content

Commit d61ad5c

Browse files
updates
1 parent 429c0d4 commit d61ad5c

File tree

3 files changed

+48
-46
lines changed

3 files changed

+48
-46
lines changed

doc/source/user_guide/tutorials/plot/plotting_data_on_specific_placements.rst

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Plot the result on the path
152152
Create the plotter and add fields and meshes. For more information about
153153
plotting data on a mesh check the tutorial: :ref:`ref_plotting_data_on_the_mesh`
154154

155-
First, define the |DpfPlotter| object [2]_ and then add |MeshedRegion|
155+
First, define the |DpfPlotter| object [2]_, then add |MeshedRegion|
156156
to it using the |add_mesh| method and add the field using the |add_field| method.
157157

158158
To display the figure built by the plotter object use the |show_figure| method.
@@ -375,18 +375,18 @@ elements with shape functions.
375375
376376
# Map the points coordinates with the displacement results and get the field
377377
mapped_disp_points = ops.mapping.on_coordinates(fields_container=my_disp,
378-
coordinates=dpf.fields_factory.field_from_array(arr=my_points.coordinates.data),
379-
create_support=True,
380-
mesh=my_meshed_region
381-
).eval()[0]
378+
coordinates=dpf.fields_factory.field_from_array(arr=my_points.coordinates.data),
379+
create_support=True,
380+
mesh=my_meshed_region
381+
).eval()[0]
382382
383383
Plot displacement field on the points
384384
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
385385

386386
Create the plotter and add fields and meshes. For more information about
387387
plotting data on a mesh check the tutorial: :ref:`ref_plotting_data_on_the_mesh`
388388

389-
First, define the |DpfPlotter| object [2]_ and then add |MeshedRegion|
389+
First, define the |DpfPlotter| object [2]_, then add |MeshedRegion|
390390
to it using the |add_mesh| method and add the field using the |add_field| method.
391391

392392
To display the figure built by the plotter object use the |show_figure| method.
@@ -409,10 +409,10 @@ To display the figure built by the plotter object use the |show_figure| method.
409409
:hide-code:
410410

411411
mapped_disp_points = ops.mapping.on_coordinates(fields_container=my_disp,
412-
coordinates=dpf.fields_factory.field_from_array(arr=my_points.coordinates.data),
413-
create_support=True,
414-
mesh=my_meshed_region
415-
).eval()[0]
412+
coordinates=dpf.fields_factory.field_from_array(arr=my_points.coordinates.data),
413+
create_support=True,
414+
mesh=my_meshed_region
415+
).eval()[0]
416416
my_plotter = dpf.plotter.DpfPlotter()
417417
my_plotter.add_mesh(meshed_region=my_meshed_region,style="surface", show_edges=True, color="w", opacity=0.3)
418418
my_plotter.add_field(field=mapped_disp_points,point_size=20.0, render_points_as_spheres=True)
@@ -433,7 +433,7 @@ Check the `Create points`_ section to understand how we defined the points coord
433433
.. code-block:: python
434434
435435
# Create the Line object
436-
my_line = geo.Line(coordinates=[[0.0, 0.06, 0.0], [0.03, 0.03, 0.03]]
436+
my_line = geo.Line(coordinates=[[0.0, 0.06, 0.0], [0.03, 0.03, 0.03]],
437437
n_points=50
438438
)
439439
@@ -452,7 +452,7 @@ You can plot the |Line| together with the mesh:
452452
.. jupyter-execute::
453453
:hide-code:
454454

455-
my_line = geo.Line(coordinates=[[0.0, 0.06, 0.0], [0.03, 0.03, 0.03]]
455+
my_line = geo.Line(coordinates=[[0.0, 0.06, 0.0], [0.03, 0.03, 0.03]],
456456
n_points=50
457457
)
458458
my_line.plot(mesh=my_meshed_region, cpos=camera_position)
@@ -471,18 +471,19 @@ elements with shape functions.
471471
472472
# Map the line coordinates with the displacement results and get the field
473473
mapped_disp_line = ops.mapping.on_coordinates(fields_container=my_disp,
474-
coordinates=my_line.mesh.nodes.coordinates_field,
475-
create_support=True,
476-
mesh=my_meshed_region
477-
).eval()[0]
474+
coordinates=my_line.mesh.nodes.coordinates_field,
475+
create_support=True,
476+
mesh=my_meshed_region
477+
).eval()[0]
478478
479479
Plot displacement field on the line
480480
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
481481

482+
Plot displacement field on the |Line| and display mesh in background.
482483
Create the plotter and add fields and meshes. For more information about
483484
plotting data on a mesh check the tutorial: :ref:`ref_plotting_data_on_the_mesh`
484485

485-
First, define the |DpfPlotter| object [2]_ and then add |MeshedRegion|
486+
First, define the |DpfPlotter| object [2]_, then add |MeshedRegion|
486487
to it using the |add_mesh| method and add the field using the |add_field| method.
487488

488489
To display the figure built by the plotter object use the |show_figure| method.
@@ -505,13 +506,13 @@ To display the figure built by the plotter object use the |show_figure| method.
505506
:hide-code:
506507

507508
mapped_disp_line = ops.mapping.on_coordinates(fields_container=my_disp,
508-
coordinates=my_line.mesh.nodes.coordinates_field),
509-
create_support=True,
510-
mesh=my_meshed_region
511-
).eval()[0]
509+
coordinates=my_line.mesh.nodes.coordinates_field,
510+
create_support=True,
511+
mesh=my_meshed_region
512+
).eval()[0]
512513
my_plotter = dpf.plotter.DpfPlotter()
513514
my_plotter.add_mesh(meshed_region=my_meshed_region,style="surface", show_edges=True, color="w", opacity=0.3)
514-
my_plotter.add_field(field=mapped_disp_line)
515+
my_plotter.add_field(field=mapped_disp_line,meshed_region=my_line.mesh)
515516
my_plotter.show_figure(show_axes=True, cpos=camera_position)
516517

517518
Plane
@@ -576,18 +577,19 @@ elements with shape functions.
576577
577578
# Map the line coordinates with the displacement results and get the field
578579
mapped_disp_plane = ops.mapping.on_coordinates(fields_container=my_disp,
579-
coordinates=my_plane.mesh.nodes.coordinates_field,
580-
create_support=True,
581-
mesh=my_meshed_region
582-
).eval()[0]
580+
coordinates=my_plane.mesh.nodes.coordinates_field,
581+
create_support=True,
582+
mesh=my_meshed_region
583+
).eval()[0]
583584
584585
Plot displacement field on the plane
585586
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
586587

588+
Plot displacement field on the |Plane| and display mesh in background.
587589
Create the plotter and add fields and meshes. For more information about
588590
plotting data on a mesh check the tutorial: :ref:`ref_plotting_data_on_the_mesh`
589591

590-
First, define the |DpfPlotter| object [2]_ and then add |MeshedRegion|
592+
First, define the |DpfPlotter| object [2]_, then add |MeshedRegion|
591593
to it using the |add_mesh| method and add the field using the |add_field| method.
592594

593595
To display the figure built by the plotter object use the |show_figure| method.
@@ -600,7 +602,7 @@ To display the figure built by the plotter object use the |show_figure| method.
600602
# We use custom style for the mesh so we can visualise the points
601603
my_plotter.add_mesh(meshed_region=my_meshed_region,style="surface", show_edges=True, color="w", opacity=0.3)
602604
# Add the Field to the DpfPlotter object
603-
my_plotter.add_field(field=mapped_disp_plane)
605+
my_plotter.add_field(field=mapped_disp_plane, meshed_region=my_plane.mesh, show_edges=False)
604606
# Display the plot
605607
my_plotter.show_figure(show_axes=True, cpos=camera_position)
606608
@@ -610,13 +612,13 @@ To display the figure built by the plotter object use the |show_figure| method.
610612
:hide-code:
611613

612614
mapped_disp_plane = ops.mapping.on_coordinates(fields_container=my_disp,
613-
coordinates=my_plane.mesh.nodes.coordinates_field,
614-
create_support=True,
615-
mesh=my_meshed_region
616-
).eval()[0]
615+
coordinates=my_plane.mesh.nodes.coordinates_field,
616+
create_support=True,
617+
mesh=my_meshed_region
618+
).eval()[0]
617619
my_plotter = dpf.plotter.DpfPlotter()
618620
my_plotter.add_mesh(meshed_region=my_meshed_region,style="surface", show_edges=True, color="w", opacity=0.3)
619-
my_plotter.add_field(field=mapped_disp_plane)
621+
my_plotter.add_field(field=mapped_disp_plane, meshed_region=my_plane.mesh, show_edges=False)
620622
my_plotter.show_figure(show_axes=True, cpos=camera_position)
621623

622624
.. rubric:: Footnotes

doc/source/user_guide/tutorials/plot/plotting_data_on_the_mesh.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Plotting data on the mesh
1010
.. |plot| replace:: :func:`plot()<ansys.dpf.core.field.Field.plot>`
1111
.. |plotMesh| replace:: :func:`plot()<ansys.dpf.core.meshed_region.MeshedRegion.plot>`
1212
.. |DpfPlotter| replace:: :class:`DpfPlotter<ansys.dpf.core.plotter.DpfPlotter>`
13+
.. |add_mesh| replace:: :func:`add_mesh()<ansys.dpf.core.plotter.DpfPlotter.add_mesh>`
14+
.. |add_field| replace:: :func:`add_field()<ansys.dpf.core.plotter.DpfPlotter.add_field>`
15+
.. |show_figure| replace:: :func:`show_figure()<ansys.dpf.core.plotter.DpfPlotter.show_figure>`
1316
.. |Field| replace:: :class:`Field<ansys.dpf.core.field.Field>`
1417
.. |FieldsContainer| replace:: :class:`FieldsContainer<ansys.dpf.core.field.Field>`
1518

@@ -167,12 +170,10 @@ You have to give the Fields supporting mesh as a attribute:
167170
Using the DpfPlotter class
168171
~~~~~~~~~~~~~~~~~~~~~~~~~~
169172

170-
First define the |DpfPlotter| object [2]_ and then add the Field
171-
to it using the :func:`add_field()<ansys.dpf.core.plotter.DpfPlotter.add_field>` method.
173+
First define the |DpfPlotter| object [2]_ and then add the Field to it using the |add_field| method.
172174
You have to give the Fields supporting mesh as an attribute to this method.
173175

174-
To display the figure built by the plotter object you need to use the
175-
:func:`show_figure()<ansys.dpf.core.plotter.DpfPlotter.show_figure>` method.
176+
To display the figure built by the plotter object you need to use the |show_figure| method.
176177

177178
.. code-block:: python
178179
@@ -242,11 +243,9 @@ Using the DpfPlotter class
242243
~~~~~~~~~~~~~~~~~~~~~~~~~~
243244

244245
First, define the |DpfPlotter| object [2]_ and then add |MeshedRegion|
245-
to it using the :func:`add_mesh()<ansys.dpf.core.plotter.DpfPlotter.add_mesh>` method and add the
246-
field using the :func:`add_field()<ansys.dpf.core.plotter.DpfPlotter.add_field>` method.
246+
to it using the |add_mesh| method and add the field using the |add_field| method.
247247

248-
To display the figure built by the plotter object use the
249-
:func:`show_figure()<ansys.dpf.core.plotter.DpfPlotter.show_figure>` method.
248+
To display the figure built by the plotter object use the |show_figure| method.
250249

251250
.. code-block:: python
252251
@@ -291,5 +290,4 @@ parameter (the argument must be supported by the installed PyVista version).
291290
The default |DpfPlotter| object settings display the mesh with edges and lighting
292291
enabled. Nevertheless, as we use the `PyVista <https://github.com/pyvista/pyvista>`_
293292
library to create the plot you can use additional PyVista arguments for the |DpfPlotter|
294-
object and :func:`add_field()<ansys.dpf.core.plotter.DpfPlotter.add_field>` method
295-
(available at: :func:`pyvista.plot`).
293+
object and |add_field| method (available at: :func:`pyvista.plot`).

doc/source/user_guide/tutorials/plot/plotting_meshes.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Plotting meshes
88
.. |Model| replace:: :class:`Model <ansys.dpf.core.model.Model>`
99
.. |plot| replace:: :func:`plot()<ansys.dpf.core.model.Model.plot>`
1010
.. |DpfPlotter| replace:: :class:`DpfPlotter<ansys.dpf.core.plotter.DpfPlotter>`
11+
.. |add_mesh| replace:: :func:`add_mesh()<ansys.dpf.core.plotter.DpfPlotter.add_mesh>`
12+
.. |show_figure| replace:: :func:`show_figure()<ansys.dpf.core.plotter.DpfPlotter.show_figure>`
1113

1214
DPF-Core has a variety of plotting methods for generating 3D plots of
1315
Ansys models directly from Python. These methods use VTK and leverage
@@ -142,10 +144,10 @@ parameter (the argument must be supported by the installed PyVista version).
142144
More information about the available arguments are available at :class:`pyvista.Plotter`.
143145

144146
First you have to define the |DpfPlotter| object and then add the |MeshedRegion|
145-
to it using the :func::func:`add_mesh()<ansys.dpf.core.plotter.DpfPlotter.add_mesh>` method.
147+
to it using the |add_mesh| method.
146148

147149
To display the figure built by the plotter object you need to use the
148-
:func:`show_figure()<ansys.dpf.core.plotter.DpfPlotter.show_figure>` method.
150+
|show_figure| method.
149151

150152
.. code-block:: python
151153
@@ -168,7 +170,7 @@ To display the figure built by the plotter object you need to use the
168170
The default |DpfPlotter| object settings display the mesh with edges,and lighting
169171
enabled. Nevertheless, as we use the `PyVista <https://github.com/pyvista/pyvista>`_
170172
library to create the plot you can use additional PyVista arguments for the |DpfPlotter|
171-
object and :func:`add_mesh()<ansys.dpf.core.plotter.DpfPlotter.add_mesh>` method
173+
object and |add_mesh| method
172174
(available at: :func:`pyvista.plot`).
173175

174176
You can also plot results data on its supporting mesh. For a detailed demonstration

0 commit comments

Comments
 (0)