Skip to content

Commit

Permalink
removed mat prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Mar 28, 2022
1 parent 324de73 commit 6b56ff9
Show file tree
Hide file tree
Showing 7 changed files with 354 additions and 951 deletions.
118 changes: 59 additions & 59 deletions tasks/task_10_making_CAD_geometry/1_make_CAD_shapes_from_points.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Part 1 - Making a parametric shape\n",
"\n",
Expand All @@ -20,53 +21,54 @@
" Documented: https://paramak.readthedocs.io\n",
" Published: https://f1000research.com/articles/10-27\n",
" Video presentation: https://www.youtube.com/watch?v=fXboew3U7rw"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": 9,
"source": [
"from IPython.display import HTML\n",
"HTML('<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>')"
],
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"output_type": "stream",
"text": [
"/home/jshim/miniconda3/envs/openmc-dagmc/lib/python3.8/site-packages/IPython/core/display.py:724: UserWarning: Consider using IPython.display.IFrame instead\n",
" warnings.warn(\"Consider using IPython.display.IFrame instead\")\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 9,
"metadata": {},
"execution_count": 9
"output_type": "execute_result"
}
],
"metadata": {}
"source": [
"from IPython.display import HTML\n",
"HTML('<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Bn_TcJSOvaA\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"3D shapes can be made using coordinates and CAD opperations such as extrude, rotate and sweep.\n",
"\n",
"This first example shows 4 points connected by straight edges and rotated by 180 degrees."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import paramak\n",
"my_shape = paramak.RotateStraightShape(\n",
Expand All @@ -80,20 +82,20 @@
")\n",
"\n",
"my_shape.show()"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This second example shows 4 points connected by spline edges and rotated by 180 degrees."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_shape = paramak.RotateSplineShape(\n",
" points=[\n",
Expand All @@ -106,20 +108,20 @@
")\n",
"\n",
"my_shape.show()"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This second example shows 4 points connected by straight edges and extruded by by 20."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_shape = paramak.ExtrudeStraightShape(\n",
" points=[\n",
Expand All @@ -132,20 +134,20 @@
")\n",
"\n",
"my_shape.show()"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This second example shows 4 points connected by spline edges and extruded by by 20."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_shape = paramak.ExtrudeSplineShape(\n",
" points=[\n",
Expand All @@ -158,22 +160,22 @@
")\n",
"\n",
"my_shape.show()"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Boolean opperations like cut, union and intersection are also supported.\n",
"\n",
"The following example makes two shapes and cuts the first one away from the second."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"small_Shape = paramak.ExtrudeStraightShape(\n",
" points=[\n",
Expand All @@ -197,41 +199,41 @@
")\n",
"\n",
"my_shape.show()"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The 3D volumes produced can then be:\n",
"- exported to stp files.\n",
"- exported to stl files."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_shape.export_stp('example_shape.stp')\n",
"my_shape.export_stl('example_shape.stl')"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The geometry can also be converted into a DAGMC h5m file and used in neutronics simulations.\n",
"\n",
"To visualize the h5m file it can be converted into a vtk file"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from stl_to_h5m import stl_to_h5m\n",
"\n",
Expand All @@ -242,42 +244,40 @@
"\n",
"import os\n",
"os.system('mbconvert dagmc.h5m dagmc.vtk')"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The geometry produced can be downloaded and viewed in FreeCAD (stp and stl) or Paraview (stl, vtk)"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import FileLink\n",
"display(FileLink('example_shape.stp'))\n",
"display(FileLink('example_shape.stl'))\n",
"display(FileLink('dagmc.vtk'))"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are additional Shape attributes that allow more complex shapes to be made. For more details take a look at the Documented: https://paramak.readthedocs.io"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"source": [],
"metadata": {},
"outputs": [],
"metadata": {}
"source": []
}
],
"metadata": {
Expand All @@ -296,9 +296,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.11"
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
"materials = odw.Materials(\n",
" h5m_filename='dagmc.h5m',\n",
" correspondence_dict={\n",
" 'mat_blanket':'Li4SiO4',\n",
" 'mat_plasma': 'DT_plasma'\n",
" 'blanket':'Li4SiO4',\n",
" 'plasma': 'DT_plasma'\n",
" }\n",
")\n",
"\n",
Expand Down Expand Up @@ -251,7 +251,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 6b56ff9

Please sign in to comment.