Exemple #1
0
 def test_download_kitchen_split():
     data = examples.download_kitchen(split=True)
     assert data.n_blocks
Exemple #2
0
 def test_download_kitchen():
     data = examples.download_kitchen()
     assert data.n_cells
Exemple #3
0
Plot Over Line
~~~~~~~~~~~~~~

Plot the values of a dataset over a line through that dataset
"""

# sphinx_gallery_thumbnail_number = 2
import pyvista as pv
from pyvista import examples

###############################################################################
# Volumetric Mesh
# +++++++++++++++
#
# First a 3D mesh example to demonstrate
mesh = examples.download_kitchen()

# Make two points to construct the line between
a = [mesh.bounds[0], mesh.bounds[2], mesh.bounds[4]]
b = [mesh.bounds[1], mesh.bounds[3], mesh.bounds[5]]

# Preview how this line intersects this mesh
line = pv.Line(a, b)

p = pv.Plotter()
p.add_mesh(mesh, style="wireframe", color="w")
p.add_mesh(line, color="b")
p.show()

###############################################################################
# Run the filter and produce a line plot
Exemple #4
0
:func:`pyvista.WidgetHelper.clear_line_widgets` methods respectively.
Unfortunately, PyVista does not have any helper methods to utilize this
widget, so it is necessary to pass a custom callback method.

One particularly fun example is to use the line widget to create a source for
the :func:`pyvista.DataSetFilters.streamlines` filter. Again note the use of
the ``name`` argument in ``add_mesh``.
"""

import pyvista as pv
from pyvista import examples
import numpy as np

pv.set_plot_theme('doc')

mesh = examples.download_kitchen()
furniture = examples.download_kitchen(split=True)

arr = np.linalg.norm(mesh['velocity'], axis=1)
clim = [arr.min(), arr.max()]

###############################################################################

p = pv.Plotter()
p.add_mesh(furniture, name='furniture', color=True)
p.add_mesh(mesh.outline(), color='black')
p.add_axes()


def simulate(pointa, pointb):
    streamlines = mesh.streamlines(n_points=10,
Exemple #5
0
p = pv.Plotter()
p.add_mesh(streamlines.tube(radius=0.2), lighting=False)
p.add_mesh(src)
p.add_mesh(boundary, color="grey", opacity=0.25)
p.camera_position = [(10, 9.5, -43), (87.0, 73.5, 123.0), (-0.5, -0.7, 0.5)]
p.show()


###############################################################################
# Kitchen
# +++++++
#
kpos = [(-6.68, 11.9, 11.6), (3.5, 2.5, 1.26), (0.45, -0.4, 0.8)]

mesh = examples.download_kitchen()
kitchen = examples.download_kitchen(split=True)

###############################################################################
streamlines = mesh.streamlines(n_points=40, source_center=(0.08, 3, 0.71))

###############################################################################
p = pv.Plotter()
p.add_mesh(mesh.outline(), color="k")
p.add_mesh(kitchen, color=True)
p.add_mesh(streamlines.tube(radius=0.01), scalars="velocity", lighting=False)
p.camera_position = kpos
p.show()


###############################################################################