How to get a quick viewer update? #118
-
To update the viewer, I run the Python file via the "play" button. But loading the build123d/cadquery dependencies can take a few seconds, which is a bit inconvenient when developing. So I have two related questions: Is it possible to load them once and then only execute the code that actually build the model to show? Also is there a file watcher so the viewer is updated each time the file is saved? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
The VSCode Jupyter extension allows for use of ipython cells. When I develop build123d I put imports/setup into a cell at the top and then the model I am developing + I believe the default shortcut to run the cell in VSCode is CTRL + Enter (at least on non-macos keyboards). |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer! But I don't use Jupyter and I don't plan to use it. Is it mandatory to have quick updates? |
Beta Was this translation helpful? Give feedback.
-
You need a running python instance (kernel) in the background to keep the state alive. So the answer is, you need either a running kernel (jupyter or jupyter mode) or a running interpreter (ipython extension) to get quick updates. |
Beta Was this translation helpful? Give feedback.
-
Thank you! I downloaded iPython and it works well, I can update the view by hitting F5.
|
Beta Was this translation helpful? Give feedback.
You need a running python instance (kernel) in the background to keep the state alive.
Jupyter does this, you can call repeatedly other cells' code and it will leverage the already imported libs.
If you don't want to use Jupyter, you can use the jupyter-mode in VS Code or the ipython extension (hoangkimlai.ipython) which uses a running ipython terminal where it pastes code you want to run.
So the answer is, you need either a running kernel (jupyter or jupyter mode) or a running interpreter (ipython extension) to get quick updates.