OpenScad into Jupyter Notebook?
How to create a dockefile with jupyter notebook with a OpenScad kernel
Jupyter notebook are very useful tool to write markdown and code to make easy to exaplain thing to people or also to document much well the code.
In this demo we will use OpenScad into jupyter Notebook and use Docker to run it. The repo of the full project can be founded here.
How to run
git clone https://gitlab.com/nicolalandro/openscadjupyternotebook.git
We can go into the codebase and run docker-compose
# or in newest version of docker
docker compose up
Go to localhost:8888 into your browser and you can see jupyter.
Into the dockerfile
Start from python and install jupyter notebook and nbextension
# Install Jupyter notebook
RUN apt-get update && apt-get install -y libzmq3-dev jupyter-notebook
# Configure jupyter plugin for install extension
RUN pip install --upgrade pip && pip install jupyter_contrib_nbextensions
RUN jupyter contrib nbextension install --system
RUN jupyter nbextensions_configurator enable --system
Install the openscad kernel:
# Configure Openscad kernel
RUN apt-get update && apt-get install -y xvfb openscad
RUN pip install --upgrade pip && pip install jupyter-openscad-kernel
RUN python3 -m iopenscad.install
# if you want to use jupyter lab you can also add this two line to have openscad app
# RUN jupyter labextension install jupyterlab-viewer-3d
# RUN jupyter labextension install jupyterlab-openscad-syntax-highlighting
Configure SOS to make notebook with multiple languages
# Configure SOS
RUN pip install --upgrade pip && pip install sos-notebook
RUN python3 -m sos_notebook.install
Specify the workdir and the run command:
CMD jupyter notebook --ip=0.0.0.0 --port=8888 --allow-root --NotebookApp.token=''
Again the opensource software offer to us much coiches and opportunities so continue to use it and if you want, contribute!