Spaces:
Runtime error
Runtime error
kolibril13 commited on
Commit ·
22d2e4a
1
Parent(s): 3765da1
remove widget
Browse files- pages/02_widget.ipynb +0 -75
pages/02_widget.ipynb
DELETED
|
@@ -1,75 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "code",
|
| 5 |
-
"execution_count": null,
|
| 6 |
-
"metadata": {},
|
| 7 |
-
"outputs": [],
|
| 8 |
-
"source": [
|
| 9 |
-
"import bpy\n",
|
| 10 |
-
"from IPython.display import display\n",
|
| 11 |
-
"from anywidget_3dviewer import Viewer\n",
|
| 12 |
-
"import solara\n",
|
| 13 |
-
"from pathlib import Path\n",
|
| 14 |
-
"\n",
|
| 15 |
-
"\n",
|
| 16 |
-
"def make_gltf_model():\n",
|
| 17 |
-
" bpy.ops.preferences.addon_enable(module=\"io_scene_gltf2\")\n",
|
| 18 |
-
" bpy.ops.object.select_all(action=\"DESELECT\")\n",
|
| 19 |
-
" bpy.ops.object.select_by_type(type=\"MESH\")\n",
|
| 20 |
-
"\n",
|
| 21 |
-
" bpy.ops.object.delete()\n",
|
| 22 |
-
" bpy.ops.mesh.primitive_cube_add(size=2, align=\"WORLD\", location=(0, 1, 1))\n",
|
| 23 |
-
" cube = bpy.context.active_object\n",
|
| 24 |
-
" gltf_path = \"./model_cube.gltf\"\n",
|
| 25 |
-
" bpy.ops.object.select_all(action=\"DESELECT\")\n",
|
| 26 |
-
" cube.select_set(True)\n",
|
| 27 |
-
" bpy.ops.export_scene.gltf(\n",
|
| 28 |
-
" filepath=gltf_path, export_format=\"GLTF_EMBEDDED\", use_selection=True\n",
|
| 29 |
-
" )\n",
|
| 30 |
-
" gltf_path = Path() / \"model_cube.gltf\"\n",
|
| 31 |
-
" data = gltf_path.read_bytes()\n",
|
| 32 |
-
" gltf_path.unlink()\n",
|
| 33 |
-
" return data\n",
|
| 34 |
-
"\n",
|
| 35 |
-
"data = make_gltf_model()\n",
|
| 36 |
-
"\n",
|
| 37 |
-
"@solara.component\n",
|
| 38 |
-
"def Page():\n",
|
| 39 |
-
" viewer = Viewer(gltf_data=data)\n",
|
| 40 |
-
" display(viewer)\n",
|
| 41 |
-
"\n",
|
| 42 |
-
"\n",
|
| 43 |
-
"Page()"
|
| 44 |
-
]
|
| 45 |
-
},
|
| 46 |
-
{
|
| 47 |
-
"cell_type": "code",
|
| 48 |
-
"execution_count": null,
|
| 49 |
-
"metadata": {},
|
| 50 |
-
"outputs": [],
|
| 51 |
-
"source": []
|
| 52 |
-
}
|
| 53 |
-
],
|
| 54 |
-
"metadata": {
|
| 55 |
-
"kernelspec": {
|
| 56 |
-
"display_name": ".venv",
|
| 57 |
-
"language": "python",
|
| 58 |
-
"name": "python3"
|
| 59 |
-
},
|
| 60 |
-
"language_info": {
|
| 61 |
-
"codemirror_mode": {
|
| 62 |
-
"name": "ipython",
|
| 63 |
-
"version": 3
|
| 64 |
-
},
|
| 65 |
-
"file_extension": ".py",
|
| 66 |
-
"mimetype": "text/x-python",
|
| 67 |
-
"name": "python",
|
| 68 |
-
"nbconvert_exporter": "python",
|
| 69 |
-
"pygments_lexer": "ipython3",
|
| 70 |
-
"version": "3.10.13"
|
| 71 |
-
}
|
| 72 |
-
},
|
| 73 |
-
"nbformat": 4,
|
| 74 |
-
"nbformat_minor": 2
|
| 75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|