-
Notifications
You must be signed in to change notification settings - Fork 4
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
Consider a more robust exec approach #5
Comments
It should be fixed in the last version of pip package / docker image. Do you want to give a try? |
It behaves pretty strange: I start with
Then I change |
I cannot not reproduce this. Do you use the docker version of cadquery-server or the pip one? |
I use pip. I anyhow have cadquery installed and don't need the whole docker infrastructure on my Mac |
... and the pip version allows to load step files. Not sure this is supported with docker where the interpreter runs in the container |
It would be great if you could get rid of the server component. My viewer approach uses zmq. There is a version for Javascript: https://github.com/zeromq/zeromq.js It seems that the server component in javascript or typescript running in VS Code can receive messages from python zmq lib. |
Yes, this is totally legit, I just want to understand how to reproduce the bug, I don't have it on the docker version.
The solution with zmq is interesting. I made the choice of the server part because of these two benefits:
The first point could be eventually solved with CadQuery/cadquery#1048. |
I agree, installing CadQuery is not always fun. I have spent quite some time on it in the past. So the docker approach is good, but is a little bit inflexible: CadQuery doesn't have a short term release strategy (2.1. is more than 1 year old and everyone works with the latest master) and with your docker container I am restricted to the version you provide. I cannot quickly pip install the git repo (If OCP doesn't change, pip of Cadquery repo is sufficient). By the way, can I load e.g. step files with the docker version? Or save STL results for my 3d printer? I personally don't really trust the
I understand this issue. I solved it in my workflow by working in Jupyter. I import cadquery only once for a session and even better, really complex interims results can be calculated once and then used in the cells below without recalculation. Big benefit for my workflows. I don't want to open the IDE vs. Notebook discussion. Just explain my approach to avoid the loading times (latency is an issue in general, so my latest version of Jupyter CadQuery - nearly ready - will have caching for bounding box calculations and tessellation results and uses multiprocessing for large CAD assemblies. That is a much bigger performance booster than avoiding the import of cadquery. Note this is only available in Jupyter-CadQuery not in three-cad-viewer). But agreed, it is a difficult decision, and one has to go one route ... |
Yes, using a docker volume: I agree that the server and exec approach is not perfect. I could eventually give the choice between using the cadquery server or not. |
One way to overcome the latency is to use "shift-enter" approach in VS Code. However, both the "cadquery-server" and the "shift-enter" approach do not allow step-by-step debugging. |
At least from a debugging perspective, I don't feel that the Also a "Run without Debugging" is really fast on my laptop: Given that experience, on my laptop I definitely would prefer to work without |
I made some work on this! It consists on a huge change on the cadquery-server behavior. The exec approach is not used anymore, instead the server executes the CadQuery code and renders the model using three-cad-viewer. Finally, it includes a file watcher that reloads the Python code and update the web page when the file is updated: cq-server_v0-2-1_demo.webmThis approach allows to debug the code in VSCode. In VSCode, the web page can be displayed using LivePreview extension ( I moved it in a dedicated repository and can be installed with Do you want to give a try? :) |
Hi @roipoussiere |
wilsonzlin/minify-html@29e7b1c doesn't sound promising |
Cloned it and gave it a try:
|
I think you can use minify html 0.9.2. And it's only used for export when --minify option is passed to cli.
In fact I realized it's not possible currently, the issue has been reported here: njourdane/cadquery-server#27. The idea is to actually execute the script when using the debugger, instead of reloading it using cq-server. |
@roipoussiere Just for information:
Both vsix and wheel can be found in https://github.com/bernhard-42/vscode-cadquery-viewer/releases at the moment. This gif shows both, using "Run in Python Terminal" (very fast for small experimental code snippets) and proper "Debugging" with VSCode debugger: |
exec
fails with simple (an natural) approaches:fails with
So let's change it (just for the test, I would never program like that):
Now, this fails with
exec
just doesn't play well with global variablesOf course, this works:
However I would need to adapt my style of coding - especially for quick hacks - to the limitations of exec.
Maybe there is a more robust way?
The text was updated successfully, but these errors were encountered: