Hello,
how I can get the selected Cell id within a callback in the vtk-view?
Thank you
Hello,
how I can get the selected Cell id within a callback in the vtk-view?
Thank you
Hi @hello12 welcome to the forums.
VTK related questions are quite infrequent. Could you add a MRE?
Hello,
could you please tell me what a MRE is?
Sure:
Ok I provided an example. I pollute the vtk-view with a lot of GeometryRepresentations each with low number of points.
When I click one of the representations, I would like to know the Cell Id as it is also done with the CellPicker in pure VTK. How do I get this information?
If I have access to the renderer and/or interactor of vtk, I could implement the CellPicker by my own. I just dont know how to access or to retrieve the cell id.
Somebody knows how?
import json
from dash import Dash, html, Input, Output
import dash_vtk
view = dash_vtk.View(
id="click-info-view",
pickingModes=["click"],
children=[
*list_of_vtkGeometryRepresentations
],
)
# Dash setup
app = Dash(__name__)
server = app.server
app.layout = html.Div([
html.Div(view, style={"width": "100%", "height": "300px"}),
html.B("Output of clickInfo (try clicking on the object above):"),
html.Pre(
id="click-info-output",
style={'overflowX': 'scroll'}
)
])
@app.callback(
Output('click-info-output', 'children'),
Input('click-info-view', 'clickInfo')
)
def display_clicked_content(click_info):
# TODO: HERE I NEED THE CELL ID OR ACCESS TO THE RENDERER/INTERACTOR/PICKER OF VTK
return json.dumps(click_info, indent=2)
if __name__ == "__main__":
app.run_server(debug=True)