Skip to content

Commit f982be3

Browse files
Merge pull request #317 from banesullivan/patch-1
Fix setting of texture coordinates
2 parents 4274e45 + ed71bd0 commit f982be3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

gemgis/visualization.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,15 @@ def create_mesh_from_cross_section(linestring: shapely.geometry.linestring.LineS
505505
# Creating PyVista PolyData
506506
surface = pv.PolyData(vertices, faces)
507507

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

511518
return surface
512519

0 commit comments

Comments
 (0)