Skip to content

Commit

Permalink
Use custom VTK with OSMesa wheel to build the docs (#1942)
Browse files Browse the repository at this point in the history
* use our wheel

* install osmesa lib

* Delete extract-edges.py

* remove headless display install

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Trivial change

* another trivial change

* add back in modified extract edges

* remove trailing whitespace

* minor style changes

* ignore flake8 for osmnx import
  • Loading branch information
akaszynski committed Dec 18, 2021
1 parent a022d78 commit 9849318
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ mypy:

lint:
@echo "Linting with flake8"
# Check for codestyle
flake8 .
@flake8 .

isort:
@echo "Formatting with isort"
# Check for trailing whitespace
isort .
14 changes: 7 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,12 @@ jobs:
pip install -e .
displayName: Install pyvista
- script: |
.ci/setup_headless_display.sh
# python .ci/pyvista_test.py # for debug
displayName: Install headless display
- script: |
sudo apt-get install python3-tk pandoc
sudo apt-get update
sudo apt-get install python3-tk pandoc libosmesa6
pip install -r requirements_docs.txt
displayName: 'Install dependencies'
- script: |
EXAMPLES_PATH=$(python -c "import pyvista; print(pyvista.EXAMPLES_PATH)")
mkdir -p EXAMPLES_PATH
Expand All @@ -132,6 +128,10 @@ jobs:
path: '$(Build.SourcesDirectory)/doc/examples'
displayName: Build pyvista doc examples cache

# note: built this wheel using Ubuntu 20.04.3 with OSMESA
- script: |
pip install https://github.com/pyvista/pyvista-wheels/raw/add_v9_1_0/vtk-osmesa-9.1.0-cp38-cp38-linux_x86_64.whl
displayName: "Install VTK build with osmesa 9.1.0"
- script: |
make -C doc html SPHINXOPTS="-w build_errors.txt -N"
displayName: 'Build documentation'
Expand Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,10 @@ def reset_pyvista(gallery_conf, fname):
pyvista.set_plot_theme('document')


# skip building the osmnx example if osmnx is not installed
has_osmnx = False
try:
import osmnx, fiona
import osmnx, fiona # noqa: F401 isort: skip
has_osmnx = True
except:
pass
Expand Down
24 changes: 12 additions & 12 deletions examples/01-filter/extract-edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Extract Edges
~~~~~~~~~~~~~
Extracts edges from a surface.
Extract edges from a surface.
"""

# sphinx_gallery_thumbnail_number = 2
Expand All @@ -19,30 +19,29 @@
# 3. feature edges (edges used by two triangles and whose dihedral angle > feature_angle)
# 4. manifold edges (edges used by exactly two polygons).
#
# This filter will extract those edges given a feature angle and return a dataset
# The :func:`extract_feature_edges() <pyvista.PolyDataFilters.extract_feature_edges>`
# filter will extract those edges given a feature angle and return a dataset
# with lines that represent the edges of the original mesh.
# To demonstrate, we will first extract the edges around Queen Nefertiti's eyes:

# Load Queen Nefertiti mesh
mesh = examples.download_nefertiti()
#
# To demonstrate, we will first extract the edges around a sample CAD model:

# Extract the edges above a 12 degree feature angle
edges = mesh.extract_feature_edges(12)
# Download the example CAD model and extract all feature edges above 45 degrees
mesh = examples.download_cad_model()
edges = mesh.extract_feature_edges(45)

# Render the edge lines on top of the original mesh
# Render the edge lines on top of the original mesh. Zoom in to provide a better figure.
p = pv.Plotter()
p.add_mesh(mesh, color=True)
p.add_mesh(edges, color="red", line_width=5)
# Define a camera position that will zoom to her eye
p.camera_position = [(96.0, -197.0, 45.0), (7.0, -109.0, 22.0), (0, 0, 1)]
p.camera.zoom(1.5)
p.show()


###############################################################################
# We can do this analysis for any :class:`pyvista.PolyData` object. Let's try
# the cow mesh example:

mesh = examples.download_cow()

edges = mesh.extract_feature_edges(20)

p = pv.Plotter()
Expand All @@ -59,6 +58,7 @@

# Download a sample surface mesh with visible open edges
mesh = examples.download_bunny()
mesh

###############################################################################
# We can get a count of the open edges with:
Expand Down

0 comments on commit 9849318

Please sign in to comment.