I wanted to create feature on the web where the user can upload a 3mf or STL CAD model and interact with it. Basically, allow the user to rotate and translate the CAD model in the browser relative to a fixed coordinate system. I have been going through the Dash and Plotly documentation, but I was not able to find anything that could allow me to do this and I wanted to ask if Dash does provide a way to do this?
Check out the Pyvista STL reader and dash_vtk. The mesh element from pyvista’s reader function can be directly fed to the dash_vkt.utils.to_mesh_state function to create a dash_vtk.Mesh from it. Minor caveat is that the to_mesh_state function is basically undocumented and only used in examples, but luckily it’s rather straightforward to use.
After creating the pyvista mesh object you can closely follow the Geometry Rendering Example to see how to visualize it (see the full code). Your only difference will be that the dataset from the example will be your mesh from pyvista.
Thanks! I am going through those resources and it seems that I can use Pyvista to load the stl model and have that open up in dash vtk. The geometry rendering example allows me to rotate the model but there is no translation features with a coordinate axis. I see that dash_vtk.View object asks for camera coordinates, so there must be a coordinate system fixed in the rendering. And the interactor action settings only allow pan, zoom, roll and zoomToMouse which doesn’t provide any translation feature.