-
Notifications
You must be signed in to change notification settings - Fork 352
WIP: non-blocking show using trame/vtk #1786
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1786 +/- ##
==========================================
+ Coverage 95.66% 95.74% +0.07%
==========================================
Files 28 29 +1
Lines 7431 7583 +152
Branches 1122 1141 +19
==========================================
+ Hits 7109 7260 +151
Misses 193 193
- Partials 129 130 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@jmwright @lorenzncode I'm not saying this is ready, but would you be able to give this a try? Just to collect some datapoints on possible issues... |
I tested on linux.
|
OK I forgot you probably intend this to be run from ipython. In that case the server does stay running. |
I created a new venv for the changes and installed via pip, and it seems to work. Two corrections for your sample code at top. from cadquery.fig import Figure() should be... from cadquery.fig import Figure and fit.clear() should be... fig.clear() The server continued to run when started by entering the code into the Python REPL and all updates showed up in the 3D viewer. The mouse rotation of the scene is a little laggy, even though my laptop does not normally struggle with 3D rendering. Debian 12, AMD64, local install via pip. |
Thanks for the feedback.
|
Yes, that's correct. It works fine with cadquery.vis and cq-editor (and I expect this PR after adding a browser). I only meant that if this was a server it could be an alternative display method which might have some advantages. Sorry to get off topic. Here is how I use the container today:
Then in container run script: podman run -it --entrypoint=/bin/bash --userns=keep-id \
--security-opt label=type:container_runtime_t \
-e XDG_RUNTIME_DIR=/tmp \
-e DISPLAY=${display} \
-e "WAYLAND_DISPLAY=$way_display" \
-v /run/user/$user_uid/${way_display}:/tmp/${way_display} \
-v "$XDG_RUNTIME_DIR/${way_display}:/tmp/${way_display}" \
-v /tmp/.X11-unix/${x_socket}:/tmp/.X11-unix/${x_socket} \
... |
What are the blockers to merging this @adam-urbanczyk ? Is it that you want to wait for WASM/VTK 9.4? |
No, let's try to merge this. |
For now only tested on windows CI due to GUI availability. My understanding is that after moving to wasm based rendering, this won't be an issue anymore (i.e. it will be possible to test on every runner). |
I'm looking for a way to preserve a custom zoom and viewer position on Say I'm iterating in ipython repeating runs of a script.
After the first run I modified the viewer position and zoom by interacting with the browser. On the second run I'd like to hide/remove a shape temporarily without disturbing the zoom and camera. Script on first run: from cadquery.func import box
from cadquery.fig import Figure
fig = Figure()
xval = 1.1
s1 = box(1, 1, 1)
s2 = box(1, 1, 1).move(x=xval)
s3 = box(1, 1, 1).move(x=2 * xval)
fig.show(s1, color="red")
fig.show(s2, color="green")
fig.show(s3, color="blue") Script on second run: from cadquery.func import box
from cadquery.fig import Figure
fig = Figure()
xval = 1.1
s1 = box(1, 1, 1)
s2 = box(1, 1, 1).move(x=xval)
s3 = box(1, 1, 1).move(x=2 * xval)
fig.clear()
fig.show(s1, color="red")
fig.show(s2, color="green")
#fig.show(s3, color="blue") s3 is removed. The zoom and camera are also reset. I can workaround it with following in REPL after first run.: fig.clear(s3) Then for second run: do not call |
I changed the default to not reset. You can always call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @adam-urbanczyk ! This is working for me.
Future enhancements might include:
- add camera options
- maybe a widget to control object visibily similar to CQ-editor
Closes #1784 (?)
API: