Skip to content

Commit

Permalink
added jupyter k3D extension needed to run k3d in Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ChHarding committed Feb 23, 2024
1 parent 059cf8f commit 772a78f
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 11 deletions.
40 changes: 30 additions & 10 deletions TouchTerrain_jupyter_for_starters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"metadata": {},
"source": [
"# TouchTerrain standalone in a jupyter notebook - starter edition\n",
"Chris Harding, Dec. 16 , 2022 (<[email protected]>)\n",
"Chris Harding, Feb. 23 , 2024 (<[email protected]>)\n",
"\n",
"- This notebook is meant for users who are new to jupyter notebooks and Python. It walks through the process of using TouchTerrain with many more small steps at a slower pace, makes less assumptions and gives more explanations - but will also hide some advanced details.\n",
"- It assumes that you are using it via the touchterrain docker container and that you have downloaded the docker image from https://github.com/ChHarding/TouchTerrain_jupyter_docker (which contains a complete Linux system with all packages and libraries needed for TouchTerrain), have created the touch_terrain docker container, have run the install script and have started a local jupyter server via the run script.\n",
Expand Down Expand Up @@ -516,9 +516,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Preview the model\n",
"## Preview the model (not using Docker, Colab or Binder)\n",
"- __if you're running docker, see below to install and activate the jupyter k3d extension for 3D previews first!__\n",
"- run the cell below to get a 3D Preview of the model. If you have multiple tiles they will have different colors.\n",
"- Dec. 8, 2022: This may not work when run inside Docker ...\n",
"- You could also use this <a href=\"https://stlviewer.kwebpia.net/\" target=\"_blank\">Online viewer</a>. Just drop your downloaded stl file into it. (Disclaimer: I'm not affiliated with them and there may be other/better viewers out there!) \n",
"- On Windows an app called __3D Builder__ seems to work well as STL viewer"
]
Expand Down Expand Up @@ -552,6 +552,33 @@
"rmtree(folder)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Preview the model (using Docker)\n",
"- install and enable the jupyter k3d extension by running the two cells below\n",
"- now you should be able to run the cell above to get a 3D preview of the model. If you have multiple tiles they will have different colors."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!jupyter nbextension install --py --user k3d"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!jupyter nbextension enable k3d --user --py"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -584,13 +611,6 @@
"- For more see https://github.com/ChHarding/TouchTerrain_jupyter_docker#download-the-image-and-run-the-container\n",
"- Once jupyter is running, re-upload anything you need (notebook, data) to the container and resume working"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
34 changes: 33 additions & 1 deletion TouchTerrain_standalone_jupyter_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,39 @@
"\n",
"- If you want to visualize your model(s), install k3d (`pip install k3d`) and run the cell below\n",
"- this won't work with OBJ files, as k3d can't read them in.\n",
"- binary STL should work, but ascii may not.\n"
"- binary STL should work, but ascii may not.\n",
"- each tile will have a random color, so you can see the individual tiles"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# install k3d using the jupyter magic %pip command\n",
"%pip install k3d"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# If you're running this notebook in Docker, you need to also install\n",
"# and activate the jupyter k3d extension\n",
"!jupyter nbextension install --py --user k3d"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# activate extension\n",
"!jupyter nbextension enable k3d --user --py"
]
},
{
Expand Down

0 comments on commit 772a78f

Please sign in to comment.