We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import pyvista import pyvista as pv from pyvista import examples import numpy as np from pyvista.examples import planefile
class Picker: def init(self, plotter, mesh): self.plotter = plotter self.mesh = mesh self._points = []
@property def points(self): """To access all th points when done.""" return self._points def __call__(self, *args): picked_pt = np.array(self.plotter.pick_mouse_position()) #picked_pt[2]=0 print(picked_pt) direction = picked_pt - self.plotter.camera_position[0] direction = direction / np.linalg.norm(direction) start = picked_pt - 1000 * direction end = picked_pt + 10000 * direction point, ix = self.mesh.ray_trace(start, end, first_point=True) if len(point) > 0: self._points.append(point) w = p.add_mesh(pv.Sphere(radius=3.0 , center=picked_pt), color='red') return
mesh = examples.load_airplane()
p = pv.Plotter(notebook=False) p.add_mesh(mesh, show_edges=True, color='w')
picker = Picker(p, mesh) p.track_click_position(picker, side='right') p.add_text('Use right mouse click to pick points') p.show_axes()
p.show()
The text was updated successfully, but these errors were encountered:
i can using this code to put points on the outside of the mesh, put i want to put points inside the mesh too. thanks for our helpe
Sorry, something went wrong.
No branches or pull requests
import pyvista
import pyvista as pv
from pyvista import examples
import numpy as np
from pyvista.examples import planefile
class Picker:
def init(self, plotter, mesh):
self.plotter = plotter
self.mesh = mesh
self._points = []
mesh = examples.load_airplane()
p = pv.Plotter(notebook=False)
p.add_mesh(mesh, show_edges=True, color='w')
picker = Picker(p, mesh)
p.track_click_position(picker, side='right')
p.add_text('Use right mouse click to pick points')
p.show_axes()
p.show()
The text was updated successfully, but these errors were encountered: