注釈
Go to the end をクリックすると完全なサンプルコードをダウンロードできます.
距離を測る#
この例では、2点間の距離を測定する方法を示しています. add_measurement_widget()
.
from __future__ import annotations
import pyvista as pv
cube = pv.Cube()
cube2 = pv.Cube([10, 10, 0])
pl = pv.Plotter()
pl.add_mesh(cube)
pl.add_mesh(cube2)
def callback(a, b, distance):
pl.add_text(f'Distance: {distance:.2f}', name='dist')
pl.add_measurement_widget(callback)
pl.show()

Total running time of the script: (0 minutes 0.214 seconds)