import dash import dash_vtk import dash_html_components as html from dash.dependencies import Input, Output # Get it here: https://github.com/plotly/dash-vtk/blob/master/demos/data/cow-nonormals.obj with open("datasets/cow-nonormals.obj", 'r') as file: txt_content = file.read() view = dash_vtk.View( id="click-info-view", pickingModes=["click"], children=[ dash_vtk.GeometryRepresentation(id="cow-geometry", children=[ dash_vtk.Reader( vtkClass="vtkOBJReader", parseAsText=txt_content, ), ]), ], ) # Dash setup app = dash.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'}
"capping": False, }, ) ]), dash_vtk.GeometryRepresentation( property={ "color": [0.4, 0.4, 0.4], }, actor={ "position": [0.5, 0.2, 0.4], "scale": [0.3, 0.3, 0.3], }, children=[ dash_vtk.Reader( vtkClass="vtkOBJReader", url= "https://kitware.github.io/vtk-js-datasets/data/obj-mtl/star-wars-vader-tie-fighter.obj", ) ], ), dash_vtk.GeometryRepresentation( id="rep", property={ "pointSize": 10, }, colorDataRange=[0, 3], mapper={ "colorByArrayName": "Temperature", "scalarMode": 3, "interpolateScalarsBeforeMapping": True, },