Skip to content

Commit d5644d9

Browse files
committed
minor updates to jupyter notebooks
1 parent 9d0feae commit d5644d9

File tree

5 files changed

+77
-128
lines changed

5 files changed

+77
-128
lines changed

jupyter_notebooks/load_step_ap203_one_shape.ipynb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@
5757
"source": [
5858
"my_renderer.Display()"
5959
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": null,
64+
"metadata": {},
65+
"outputs": [],
66+
"source": []
6067
}
6168
],
6269
"metadata": {

jupyter_notebooks/set_callback.ipynb

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"cell_type": "code",
28-
"execution_count": 2,
28+
"execution_count": null,
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
@@ -38,7 +38,7 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": 3,
41+
"execution_count": null,
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
@@ -50,43 +50,35 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 4,
53+
"execution_count": null,
5454
"metadata": {},
5555
"outputs": [],
5656
"source": [
5757
"def a_callback(shp):\n",
5858
" \"\"\"called each time a double click is performed\"\"\"\n",
59-
" my_renderer.html.value = \"Callback executed !\"\n",
59+
" my_renderer.html.value = f\"Callback executed from shape {hash(shp)}\"\n",
6060
"\n",
6161
"\n",
6262
"my_renderer.register_select_callback(a_callback)"
6363
]
6464
},
6565
{
6666
"cell_type": "code",
67-
"execution_count": 5,
67+
"execution_count": null,
6868
"metadata": {},
69-
"outputs": [
70-
{
71-
"data": {
72-
"application/vnd.jupyter.widget-view+json": {
73-
"model_id": "1ec28fcf50dc415bb7a3208fc1666038",
74-
"version_major": 2,
75-
"version_minor": 0
76-
},
77-
"text/plain": [
78-
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=True, description='Axes', layout=Layout(height='au…"
79-
]
80-
},
81-
"metadata": {},
82-
"output_type": "display_data"
83-
}
84-
],
69+
"outputs": [],
8570
"source": [
8671
"my_renderer.DisplayShape(torus_shp, shape_color=\"blue\")\n",
8772
"my_renderer.DisplayShape(box_shp, shape_color=\"red\")\n",
8873
"my_renderer.DisplayShape(sphere_shp, shape_color=\"green\", update=True)"
8974
]
75+
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": null,
79+
"metadata": {},
80+
"outputs": [],
81+
"source": []
9082
}
9183
],
9284
"metadata": {

jupyter_notebooks/splitter_demo_V2.ipynb

Lines changed: 31 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -28,32 +28,9 @@
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": 2,
31+
"execution_count": null,
3232
"metadata": {},
33-
"outputs": [
34-
{
35-
"name": "stdout",
36-
"output_type": "stream",
37-
"text": [
38-
"Shape type of Polygon after .Close() <bound method TopoDS_Shape.ShapeType of <class 'TopoDS_Wire'>>\n",
39-
"Shape type of Face <bound method TopoDS_Shape.ShapeType of <class 'TopoDS_Face'>>\n"
40-
]
41-
},
42-
{
43-
"data": {
44-
"application/vnd.jupyter.widget-view+json": {
45-
"model_id": "e1f5e57367804eff8d4cfc0a76bdc989",
46-
"version_major": 2,
47-
"version_minor": 0
48-
},
49-
"text/plain": [
50-
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=True, description='Axes', layout=Layout(height='au…"
51-
]
52-
},
53-
"metadata": {},
54-
"output_type": "display_data"
55-
}
56-
],
33+
"outputs": [],
5734
"source": [
5835
"# See https://dev.opencascade.org/doc/overview/html/occt_user_guides__modeling_algos.html\n",
5936
"\n",
@@ -101,17 +78,9 @@
10178
},
10279
{
10380
"cell_type": "code",
104-
"execution_count": 3,
81+
"execution_count": null,
10582
"metadata": {},
106-
"outputs": [
107-
{
108-
"name": "stdout",
109-
"output_type": "stream",
110-
"text": [
111-
"<bound method TopoDS_Shape.ShapeType of <class 'TopoDS_Compound'>>\n"
112-
]
113-
}
114-
],
83+
"outputs": [],
11584
"source": [
11685
"print(result.ShapeType)"
11786
]
@@ -126,7 +95,7 @@
12695
},
12796
{
12897
"cell_type": "code",
129-
"execution_count": 4,
98+
"execution_count": null,
13099
"metadata": {},
131100
"outputs": [],
132101
"source": [
@@ -141,24 +110,9 @@
141110
},
142111
{
143112
"cell_type": "code",
144-
"execution_count": 5,
113+
"execution_count": null,
145114
"metadata": {},
146-
"outputs": [
147-
{
148-
"data": {
149-
"application/vnd.jupyter.widget-view+json": {
150-
"model_id": "c469e80a8c644a1e8a13bea6dc271bdc",
151-
"version_major": 2,
152-
"version_minor": 0
153-
},
154-
"text/plain": [
155-
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=True, description='Axes', layout=Layout(height='au…"
156-
]
157-
},
158-
"metadata": {},
159-
"output_type": "display_data"
160-
}
161-
],
115+
"outputs": [],
162116
"source": [
163117
"rnd = JupyterRenderer()\n",
164118
"colors = [\"#DB0570\", \"#0506DB\"]\n",
@@ -181,33 +135,9 @@
181135
},
182136
{
183137
"cell_type": "code",
184-
"execution_count": 6,
138+
"execution_count": null,
185139
"metadata": {},
186-
"outputs": [
187-
{
188-
"name": "stdout",
189-
"output_type": "stream",
190-
"text": [
191-
"Shape type of Polygon after .Close() <bound method TopoDS_Shape.ShapeType of <class 'TopoDS_Wire'>>\n",
192-
"Shape type of result <bound method TopoDS_Shape.ShapeType of <class 'TopoDS_Solid'>>\n",
193-
"Sub shapes after split [<class 'TopoDS_Solid'>]\n"
194-
]
195-
},
196-
{
197-
"data": {
198-
"application/vnd.jupyter.widget-view+json": {
199-
"model_id": "c73b8b573b3e4ce6a0722f194146a3bc",
200-
"version_major": 2,
201-
"version_minor": 0
202-
},
203-
"text/plain": [
204-
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=True, description='Axes', layout=Layout(height='au…"
205-
]
206-
},
207-
"metadata": {},
208-
"output_type": "display_data"
209-
}
210-
],
140+
"outputs": [],
211141
"source": [
212142
"# See https://dev.opencascade.org/doc/overview/html/occt_user_guides__modeling_algos.html\n",
213143
"\n",
@@ -254,6 +184,27 @@
254184
"\n",
255185
"rnd.Display()"
256186
]
187+
},
188+
{
189+
"cell_type": "code",
190+
"execution_count": null,
191+
"metadata": {},
192+
"outputs": [],
193+
"source": []
194+
},
195+
{
196+
"cell_type": "code",
197+
"execution_count": null,
198+
"metadata": {},
199+
"outputs": [],
200+
"source": []
201+
},
202+
{
203+
"cell_type": "code",
204+
"execution_count": null,
205+
"metadata": {},
206+
"outputs": [],
207+
"source": []
257208
}
258209
],
259210
"metadata": {

jupyter_notebooks/torus_mesh_quality.ipynb

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 7,
5+
"execution_count": null,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -18,7 +18,7 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": 8,
21+
"execution_count": null,
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
@@ -31,7 +31,7 @@
3131
},
3232
{
3333
"cell_type": "code",
34-
"execution_count": 9,
34+
"execution_count": null,
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
@@ -43,7 +43,7 @@
4343
},
4444
{
4545
"cell_type": "code",
46-
"execution_count": 10,
46+
"execution_count": null,
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
@@ -56,27 +56,19 @@
5656
},
5757
{
5858
"cell_type": "code",
59-
"execution_count": 11,
59+
"execution_count": null,
6060
"metadata": {},
61-
"outputs": [
62-
{
63-
"data": {
64-
"application/vnd.jupyter.widget-view+json": {
65-
"model_id": "3e898758932d41648b5e425691996fbb",
66-
"version_major": 2,
67-
"version_minor": 0
68-
},
69-
"text/plain": [
70-
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=True, description='Axes', layout=Layout(height='au…"
71-
]
72-
},
73-
"metadata": {},
74-
"output_type": "display_data"
75-
}
76-
],
61+
"outputs": [],
7762
"source": [
7863
"my_renderer.Display()"
7964
]
65+
},
66+
{
67+
"cell_type": "code",
68+
"execution_count": null,
69+
"metadata": {},
70+
"outputs": [],
71+
"source": []
8072
}
8173
],
8274
"metadata": {

jupyter_notebooks/triangle_mesh_gmsh.ipynb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"\n",
1616
"# OCC imports\n",
1717
"from OCC.Display.WebGl.jupyter_renderer import JupyterRenderer\n",
18-
"from OCC.Core.BRepTools import breptools_Write\n",
18+
"from OCC.Core.BRepTools import breptools\n",
1919
"from OCC.Core.gp import gp_Vec\n",
2020
"from OCC.Extend.ShapeFactory import translate_shp\n",
2121
"from OCC.Extend.DataExchange import read_step_file, read_stl_file"
@@ -56,7 +56,7 @@
5656
"# dump the geometry to a brep file, check it worked\n",
5757
"BREP_BASENAME = \"ventilator.brep\"\n",
5858
"BREP_FILENAME = os.path.join(TMP_DIR, BREP_BASENAME)\n",
59-
"breptools_Write(ventilator_shp, BREP_FILENAME)\n",
59+
"breptools.Write(ventilator_shp, BREP_FILENAME)\n",
6060
"assert os.path.isfile(BREP_FILENAME)\n",
6161
"\n",
6262
"# create the gmesh file\n",
@@ -111,11 +111,18 @@
111111
" meshed_ventilator_shp, render_edges=True, shape_color=\"cyan\", update=True\n",
112112
")"
113113
]
114+
},
115+
{
116+
"cell_type": "code",
117+
"execution_count": null,
118+
"metadata": {},
119+
"outputs": [],
120+
"source": []
114121
}
115122
],
116123
"metadata": {
117124
"kernelspec": {
118-
"display_name": "Python 3",
125+
"display_name": "Python 3 (ipykernel)",
119126
"language": "python",
120127
"name": "python3"
121128
},
@@ -129,9 +136,9 @@
129136
"name": "python",
130137
"nbconvert_exporter": "python",
131138
"pygments_lexer": "ipython3",
132-
"version": "3.6.4"
139+
"version": "3.9.18"
133140
}
134141
},
135142
"nbformat": 4,
136-
"nbformat_minor": 2
143+
"nbformat_minor": 4
137144
}

0 commit comments

Comments
 (0)