Skip to content
New issue

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

Interactive show #1784

Open
adam-urbanczyk opened this issue Mar 5, 2025 · 3 comments · May be fixed by #1727 or #1786
Open

Interactive show #1784

adam-urbanczyk opened this issue Mar 5, 2025 · 3 comments · May be fixed by #1727 or #1786

Comments

@adam-urbanczyk
Copy link
Member

adam-urbanczyk commented Mar 5, 2025

Currently show is blocking, it would be great to be able to use it multiple times without blocking of the script execution. I see 3 options

  1. Use Qt or Tk, requires integration of the gui event loop with the interpreter (Check how IPython odes that)
  2. Run all the VTK stuff in a separate thread and periodically invoke vtkRenderWindowInteractor.ProcessEvents()
  3. Trame (+pywebview - optional)
@adam-urbanczyk adam-urbanczyk linked a pull request Mar 5, 2025 that will close this issue
5 tasks
@adam-urbanczyk
Copy link
Member Author

adam-urbanczyk commented Mar 8, 2025

Regarding 3, it is easy to get something quickly:

Image

Few observations:

  • vtkAssembly does not seem to work with vtkLocalView (VTK.js)
  • As-is I'm getting too much output in the console in Spyder
Output from spyder call 'get_state':
vtk-remote-view.size is missingvtk-remote-view.size is missingvtk-remote-view.shape is missingvtk-remote-view.shape is missingvtk-remote-view.shape is missingvtk-remote-view.shape is missingvtk-remote-view.size is missingvtk-remote-view.size is missingvtk-remote-view.size is missingvtk-remote-view.size is missingvtk-remote-view.shape is missingvtk-remote-view.shape is missingvtk-remote-view.shape is missingvtk-remote-view.shape is missingvtk-remote-view.size is missingvtk-remote-view.size is missing

@lorenzncode
Copy link
Member

I had some interest in a VTK.js based viewer (maybe as a separate project not built-in to CadQuery). I suppose the viewer could be implemented in other frameworks so Trame is one option.

  1. VTK.js single page application (browser and/or webview)
    a. Trame
    b. from scratch (bring your own framework)

@adam-urbanczyk
Copy link
Member Author

adam-urbanczyk commented Mar 9, 2025

FYI: with the current implementation VTK.js based rendering seems to be rather quirky, less so with remote rendering. With VTK 9.4 where is also a WASM option if I understand correctly, but for now we are on 9.3.

More visuals

With Remote

Image

With local (vtk.js)

Image

@adam-urbanczyk adam-urbanczyk linked a pull request Mar 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants