Skip to content

Commit f0ddad9

Browse files
committed
update notebooks for binder
1 parent 0962274 commit f0ddad9

File tree

6 files changed

+137
-95
lines changed

6 files changed

+137
-95
lines changed

notebooks/00_basics.ipynb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 5,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"%%capture\n",
10+
"%pip install compas_notebook"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {},
@@ -9,7 +19,7 @@
919
},
1020
{
1121
"cell_type": "code",
12-
"execution_count": 1,
22+
"execution_count": 2,
1323
"metadata": {},
1424
"outputs": [],
1525
"source": [
@@ -20,7 +30,7 @@
2030
},
2131
{
2232
"cell_type": "code",
23-
"execution_count": 2,
33+
"execution_count": 3,
2434
"metadata": {},
2535
"outputs": [],
2636
"source": [
@@ -29,7 +39,7 @@
2939
},
3040
{
3141
"cell_type": "code",
32-
"execution_count": 3,
42+
"execution_count": 4,
3343
"metadata": {},
3444
"outputs": [
3545
{
@@ -44,7 +54,7 @@
4454
{
4555
"data": {
4656
"application/vnd.jupyter.widget-view+json": {
47-
"model_id": "75509c7781b64199bcefa5beac0a9f19",
57+
"model_id": "4f3f899780144ac1938a528b5025e7e9",
4858
"version_major": 2,
4959
"version_minor": 0
5060
},

notebooks/10_scene.ipynb

Lines changed: 34 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,46 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": 32,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"%%capture\n",
10+
"%pip install compas_notebook"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 33,
616
"metadata": {},
717
"outputs": [],
818
"source": [
919
"import compas\n",
10-
"import compas.geometry as geometry\n",
1120
"from compas.colors import Color\n",
1221
"from compas.datastructures import Mesh\n",
22+
"from compas.geometry import Box\n",
1323
"from compas_notebook.viewer import Viewer"
1424
]
1525
},
1626
{
1727
"cell_type": "code",
18-
"execution_count": 2,
28+
"execution_count": 34,
1929
"metadata": {},
2030
"outputs": [],
2131
"source": [
22-
"box = geometry.Box()\n",
32+
"box = Box()\n",
2333
"mesh = Mesh.from_obj(compas.get('tubemesh.obj'))"
2434
]
2535
},
2636
{
2737
"cell_type": "code",
28-
"execution_count": 3,
38+
"execution_count": 35,
2939
"metadata": {},
3040
"outputs": [
31-
{
32-
"name": "stdout",
33-
"output_type": "stream",
34-
"text": [
35-
"PyThreeJS SceneObjects registered.\n"
36-
]
37-
},
3841
{
3942
"data": {
4043
"application/vnd.jupyter.widget-view+json": {
41-
"model_id": "374d5f3bb0834894ba256248c4aaa0a7",
44+
"model_id": "14f00c69ebfa47ddbe57f51eddfaadc9",
4245
"version_major": 2,
4346
"version_minor": 0
4447
},
@@ -53,13 +56,13 @@
5356
"source": [
5457
"viewer = Viewer()\n",
5558
"viewer.scene.add(box, color=Color.red())\n",
56-
"viewer.scene.add(mesh, color=Color.green())\n",
59+
"viewer.scene.add(mesh, facecolor=Color.green(), show_edges=True)\n",
5760
"viewer.show()"
5861
]
5962
},
6063
{
6164
"cell_type": "code",
62-
"execution_count": 5,
65+
"execution_count": 36,
6366
"metadata": {},
6467
"outputs": [
6568
{
@@ -76,16 +79,16 @@
7679
},
7780
{
7881
"cell_type": "code",
79-
"execution_count": 6,
82+
"execution_count": 37,
8083
"metadata": {},
8184
"outputs": [
8285
{
8386
"name": "stdout",
8487
"output_type": "stream",
8588
"text": [
86-
"└── <TreeNode root>\n",
87-
" ├── <TreeNode Box>\n",
88-
" └── <TreeNode Mesh>\n"
89+
"└── <TreeNode: ROOT>\n",
90+
" ├── <ThreeBoxObject: Box>\n",
91+
" └── <ThreeMeshObject: Mesh>\n"
8992
]
9093
}
9194
],
@@ -95,16 +98,16 @@
9598
},
9699
{
97100
"cell_type": "code",
98-
"execution_count": 7,
101+
"execution_count": 38,
99102
"metadata": {},
100103
"outputs": [
101104
{
102105
"data": {
103106
"text/plain": [
104-
"<TreeNode root>"
107+
"<TreeNode: ROOT>"
105108
]
106109
},
107-
"execution_count": 7,
110+
"execution_count": 38,
108111
"metadata": {},
109112
"output_type": "execute_result"
110113
}
@@ -115,16 +118,16 @@
115118
},
116119
{
117120
"cell_type": "code",
118-
"execution_count": 8,
121+
"execution_count": 39,
119122
"metadata": {},
120123
"outputs": [
121124
{
122125
"data": {
123126
"text/plain": [
124-
"[<TreeNode Box>, <TreeNode Mesh>]"
127+
"[<ThreeBoxObject: Box>, <ThreeMeshObject: Mesh>]"
125128
]
126129
},
127-
"execution_count": 8,
130+
"execution_count": 39,
128131
"metadata": {},
129132
"output_type": "execute_result"
130133
}
@@ -135,16 +138,16 @@
135138
},
136139
{
137140
"cell_type": "code",
138-
"execution_count": 13,
141+
"execution_count": 40,
139142
"metadata": {},
140143
"outputs": [
141144
{
142145
"data": {
143146
"text/plain": [
144-
"<TreeNode Box>"
147+
"<ThreeBoxObject: Box>"
145148
]
146149
},
147-
"execution_count": 13,
150+
"execution_count": 40,
148151
"metadata": {},
149152
"output_type": "execute_result"
150153
}
@@ -155,43 +158,23 @@
155158
},
156159
{
157160
"cell_type": "code",
158-
"execution_count": 14,
161+
"execution_count": 41,
159162
"metadata": {},
160163
"outputs": [
161164
{
162165
"data": {
163166
"text/plain": [
164-
"<TreeNode root>"
167+
"<TreeNode: ROOT>"
165168
]
166169
},
167-
"execution_count": 14,
170+
"execution_count": 41,
168171
"metadata": {},
169172
"output_type": "execute_result"
170173
}
171174
],
172175
"source": [
173176
"viewer.scene.tree.root.children[0].parent"
174177
]
175-
},
176-
{
177-
"cell_type": "code",
178-
"execution_count": 12,
179-
"metadata": {},
180-
"outputs": [
181-
{
182-
"data": {
183-
"text/plain": [
184-
"<compas_notebook.scene.boxobject.BoxObject at 0x10f0f1f40>"
185-
]
186-
},
187-
"execution_count": 12,
188-
"metadata": {},
189-
"output_type": "execute_result"
190-
}
191-
],
192-
"source": [
193-
"viewer.scene.tree.root.children[0].object"
194-
]
195178
}
196179
],
197180
"metadata": {

notebooks/20_geometry.ipynb

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
8+
"source": [
9+
"%%capture\n",
10+
"%pip install compas_notebook"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 2,
16+
"metadata": {},
17+
"outputs": [],
818
"source": [
919
"from compas.geometry import Pointcloud\n",
1020
"from compas.geometry import Point, Line, Polyline\n",
@@ -14,7 +24,7 @@
1424
},
1525
{
1626
"cell_type": "code",
17-
"execution_count": 2,
27+
"execution_count": 3,
1828
"metadata": {},
1929
"outputs": [],
2030
"source": [
@@ -27,20 +37,13 @@
2737
},
2838
{
2939
"cell_type": "code",
30-
"execution_count": 3,
40+
"execution_count": 7,
3141
"metadata": {},
3242
"outputs": [
33-
{
34-
"name": "stdout",
35-
"output_type": "stream",
36-
"text": [
37-
"PyThreeJS SceneObjects registered.\n"
38-
]
39-
},
4043
{
4144
"data": {
4245
"application/vnd.jupyter.widget-view+json": {
43-
"model_id": "f99cbe15ecf74fa9b6c7307ea8d265b2",
46+
"model_id": "1765ca6cd7b74861bda14b7a22ac7087",
4447
"version_major": 2,
4548
"version_minor": 0
4649
},
@@ -54,14 +57,22 @@
5457
],
5558
"source": [
5659
"viewer = Viewer()\n",
60+
"viewer.config.ui.sidebar.show = False\n",
5761
"\n",
58-
"viewer.scene.add(point, color=Color.red())\n",
62+
"viewer.scene.add(point, color=Color.red(), pointsize=0.3)\n",
5963
"viewer.scene.add(line)\n",
6064
"viewer.scene.add(polyline, color=Color.blue())\n",
61-
"viewer.scene.add(cloud, color=Color.green())\n",
65+
"viewer.scene.add(cloud, color=Color.green(), pointsize=0.3)\n",
6266
"\n",
6367
"viewer.show()"
6468
]
69+
},
70+
{
71+
"cell_type": "code",
72+
"execution_count": null,
73+
"metadata": {},
74+
"outputs": [],
75+
"source": []
6576
}
6677
],
6778
"metadata": {

0 commit comments

Comments
 (0)