From e02cde02ae02e9466b16cdb89677f96d6ed4f39a Mon Sep 17 00:00:00 2001 From: Jon Shimwell Date: Thu, 26 Sep 2024 23:55:04 +0100 Subject: [PATCH 1/2] not importing uninstalled package --- .github/workflows/documentation_update.yml | 2 +- ...herical_tokamak_from_plasma_with_tf_magnets.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/documentation_update.yml b/.github/workflows/documentation_update.yml index 0de8a67f..97d3e0f5 100644 --- a/.github/workflows/documentation_update.yml +++ b/.github/workflows/documentation_update.yml @@ -55,7 +55,7 @@ jobs: with: publish_branch: gh-pages github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: _build + publish_dir: _build/docs # with next rlease of actions-gh-pages # issue to allow force_orphan will be fixed # https://github.com/peaceiris/actions-gh-pages/issues/455 diff --git a/examples/spherical_tokamak_from_plasma_with_tf_magnets.py b/examples/spherical_tokamak_from_plasma_with_tf_magnets.py index edfa10ee..47a8c7e6 100644 --- a/examples/spherical_tokamak_from_plasma_with_tf_magnets.py +++ b/examples/spherical_tokamak_from_plasma_with_tf_magnets.py @@ -34,13 +34,16 @@ result.save(f"spherical_tokamak_minimal.step") - +# visualization options +# +# pip install jupyter_cadquery # needed to downgrade pip with ... python -m pip install pip==24.0 -from jupyter_cadquery import show - -view = show(result) -view.export_html("3d.html") - +# from jupyter_cadquery import show +# view = show(result) +# view.export_html("3d.html") +# +# from cadquery.vis import show +# show(result) my_model = CadToDagmc() material_tags = ["mat1"] * 7 From 8ac9e5dd2dc02497093714297e766e481083d7e6 Mon Sep 17 00:00:00 2001 From: Jon Shimwell Date: Fri, 27 Sep 2024 00:15:38 +0100 Subject: [PATCH 2/2] removed jc from examples, put in docs --- docs/usage.rst | 26 +++++++++++++++++++ .../spherical_tokamak_from_plasma_minimal.py | 4 --- ...rical_tokamak_from_plasma_with_divertor.py | 5 ---- ...cal_tokamak_from_plasma_with_pf_magnets.py | 5 ---- ...om_plasma_with_pf_magnets_and_divertors.py | 4 --- ...cal_tokamak_from_plasma_with_tf_magnets.py | 11 -------- examples/spherical_tokamak_minimal.py | 6 ----- examples/tokamak_with_pf_magnets.py | 3 --- 8 files changed, 26 insertions(+), 38 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 91fd7dfc..ad085696 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -12,6 +12,32 @@ In all cases it is possible to add additional components such as divertors, polo The reactors can be varied in terms of their radial build, vertical build, elongation and triangularity which gives a lot of variability. These examples show how to make various reactors with and without different components, each example is minimal and aims to show a single feature, you will have to combine examples to make a complete model. + +Visualization options +===================== + +The reactors (cadquery.Assembly objects) and components (cadquery.Workplane objects) can be visualized in a number of ways. +First option is to export them to STEP, BREP or STL file then open the file with your favorite CAD software for example `FreeCAD `_. +See the `CadQuery documentation on saving `_ for more information. +Other options include the built in visualization tools in CadQuery + +.. code-block:: python + + from cadquery.vis import show + show(result) # where result is the returned reactor or component object + +or the jupyter_cadquery package which allows for interactive 3D visualization in a web browser. +or the jupyter_cadquery package which allows for interactive 3D visualization in a web browser. + +.. code-block:: python + + # pip install jupyter_cadquery + # might needed to downgrade pip with ... python -m pip install pip==24.0 + from jupyter_cadquery import show + view = show(result) # where result is the returned reactor or component object + view.export_html("3d.html") + + Tokamak from plasma ------------------- diff --git a/examples/spherical_tokamak_from_plasma_minimal.py b/examples/spherical_tokamak_from_plasma_minimal.py index a8d12eb3..37592d59 100644 --- a/examples/spherical_tokamak_from_plasma_minimal.py +++ b/examples/spherical_tokamak_from_plasma_minimal.py @@ -25,10 +25,6 @@ ) my_reactor.save(f"spherical_tokamak_from_plasma_minimal.step") -# needed to downgrade pip with ... python -m pip install pip==24.0 -# from jupyter_cadquery import show -# view = show(my_reactor) -# view.export_html('3d.html') # my_model = CadToDagmc() diff --git a/examples/spherical_tokamak_from_plasma_with_divertor.py b/examples/spherical_tokamak_from_plasma_with_divertor.py index d34215a3..62858134 100644 --- a/examples/spherical_tokamak_from_plasma_with_divertor.py +++ b/examples/spherical_tokamak_from_plasma_with_divertor.py @@ -28,11 +28,6 @@ my_reactor.save("spherical_tokamak_from_plasma_with_divertor.step") print('written spherical_tokamak_from_plasma_with_divertor.step') -# needed to downgrade pip with ... python -m pip install pip==24.0 -# from jupyter_cadquery import show -# view = show(my_reactor) -# view.export_html("3d.html") - # my_model = CadToDagmc() # material_tags = ["mat1"] * 21 # the two divertors split the 3 blanket layers into 9 and the magnets also splt the blanket. diff --git a/examples/spherical_tokamak_from_plasma_with_pf_magnets.py b/examples/spherical_tokamak_from_plasma_with_pf_magnets.py index 7ccb7f2e..df88df43 100644 --- a/examples/spherical_tokamak_from_plasma_with_pf_magnets.py +++ b/examples/spherical_tokamak_from_plasma_with_pf_magnets.py @@ -43,11 +43,6 @@ ) my_reactor.save(f"spherical_tokamak_from_plasma_with_pf_magnets.step") -# needed to downgrade pip with ... python -m pip install pip==24.0 -# from jupyter_cadquery import show -# view = show(my_reactor) -# view.export_html('spherical_tokamak_from_plasma.html') - # my_model = CadToDagmc() # material_tags = ["mat1"] * 5 diff --git a/examples/spherical_tokamak_from_plasma_with_pf_magnets_and_divertors.py b/examples/spherical_tokamak_from_plasma_with_pf_magnets_and_divertors.py index 6edd914b..77c91b31 100644 --- a/examples/spherical_tokamak_from_plasma_with_pf_magnets_and_divertors.py +++ b/examples/spherical_tokamak_from_plasma_with_pf_magnets_and_divertors.py @@ -48,10 +48,6 @@ ) my_reactor.save(f"spherical_tokamak_from_plasma_with_pf_magnets_and_divertor.step") -# needed to downgrade pip with ... python -m pip install pip==24.0 -# from jupyter_cadquery import show -# view = show(my_reactor) -# view.export_html('3d.html') # my_model = CadToDagmc() diff --git a/examples/spherical_tokamak_from_plasma_with_tf_magnets.py b/examples/spherical_tokamak_from_plasma_with_tf_magnets.py index 47a8c7e6..851d640a 100644 --- a/examples/spherical_tokamak_from_plasma_with_tf_magnets.py +++ b/examples/spherical_tokamak_from_plasma_with_tf_magnets.py @@ -34,17 +34,6 @@ result.save(f"spherical_tokamak_minimal.step") -# visualization options -# -# pip install jupyter_cadquery -# needed to downgrade pip with ... python -m pip install pip==24.0 -# from jupyter_cadquery import show -# view = show(result) -# view.export_html("3d.html") -# -# from cadquery.vis import show -# show(result) - my_model = CadToDagmc() material_tags = ["mat1"] * 7 my_model.add_cadquery_object(cadquery_object=result, material_tags=material_tags) diff --git a/examples/spherical_tokamak_minimal.py b/examples/spherical_tokamak_minimal.py index 67490b2e..393628b8 100644 --- a/examples/spherical_tokamak_minimal.py +++ b/examples/spherical_tokamak_minimal.py @@ -35,12 +35,6 @@ ) my_reactor.save(f"spherical_tokamak_minimal.step") -# needed to downgrade pip with ... python -m pip install pip==24.0 -from jupyter_cadquery import show - -view = show(my_reactor) -view.export_html("3d.html") - my_model = CadToDagmc() material_tags = ["mat1"] * 6 diff --git a/examples/tokamak_with_pf_magnets.py b/examples/tokamak_with_pf_magnets.py index e954d995..5dbb199a 100644 --- a/examples/tokamak_with_pf_magnets.py +++ b/examples/tokamak_with_pf_magnets.py @@ -54,9 +54,6 @@ add_extra_cut_shapes=add_extra_cut_shapes, ) -from cadquery.vis import show -show(my_reactor) - my_reactor.save(f"tokamak_minimal.step") print(f"Saved as tokamak_minimal.step")