How to get extra string/json data by point picking #5988
Unanswered
magicarm22
asked this question in
Q&A
Replies: 2 comments 2 replies
-
It looks like you're adding class MultiBlockExtended(pv.MultiBlock):
def __init__(self, data, layer, **kwargs):
super().__init__(data, **kwargs)
self.layer = layer
def combine(self, *args, **kwargs):
out = super().combine(*args, **kwargs)
out.layer = self.layer
return out here I'm just adding an extra python attribute to the UnstructuredGrid. @user27182 was working on some stuff in #5933 to make it easier to store user attributes on meshes. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Oh right, the default callback just returns the xyz coordinates of the picked point. You need to add class Picker:
def __init__(self):
self.mesh = None
def __call__(self, picked_point, vtk_picker):
self.mesh = vtk_picker.GetDataSet() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First check
Commit to Help
Sample Code What is the problem, question, or error?
Hello, pyvista!
Thanks for your amazing tool. I'm creating a tool for QGIS to show 2d map in 3d. For now, I'm working with tubes, and I want to pick a tube to get attributes of this tube (Screenshot №1).
Because I have a lot of tubes, I optimize meshes by combining them to one mesh from one layer.
For now, I need to get the layer, which from it is by clicking on the object. But Picker returns mesh, not my custom class with extra information.
Description
This code will contains a lot of QGIS code, but I will try to show only pyvista code
System Information
Screenshots
Beta Was this translation helpful? Give feedback.
All reactions