Skip to content

Commit

Permalink
Merge pull request #317 from banesullivan/patch-1
Browse files Browse the repository at this point in the history
Fix setting of texture coordinates
  • Loading branch information
AlexanderJuestel authored Nov 24, 2023
2 parents 4274e45 + ed71bd0 commit f982be3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gemgis/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,15 @@ def create_mesh_from_cross_section(linestring: shapely.geometry.linestring.LineS
# Creating PyVista PolyData
surface = pv.PolyData(vertices, faces)

# Generating Tcoords
surface.t_coords = uv
# Set texture coordinates on PyVista mesh. This has been renamed a few times
# Reference https://github.com/pyvista/pyvista/issues/5209
try:
if pv._version.version_info < (0, 43):
surface.active_t_coords = uv
else:
surface.active_texture_coordinates = uv
except AttributeError:
raise ImportError("Please make sure you are using a compatible version of PyVista")

return surface

Expand Down

0 comments on commit f982be3

Please sign in to comment.