Skip to content

Commit

Permalink
Fix Examples documentation (#4070)
Browse files Browse the repository at this point in the history
* Fix logger
Fix release example
Add release all True for Documentation

* Fix pyVista error in example

* Add no cover

* Fix array example

* Fix array example

* Fix array example

* Fix array example
  • Loading branch information
Samuelopez-ansys authored Jan 12, 2024
1 parent 4fb4f07 commit 56a3bc9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion doc/source/User_guide/intro.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Minimal Example
Minimal example
===============

You can initiate AEDT in non-graphical mode from Python using this code:
Expand Down
4 changes: 2 additions & 2 deletions doc/source/User_guide/pyaedt_file_data/project.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Project Configuration file
Project configuration file
==========================

The project configuration file is the most comprehensive format that allows to apply a set of variables, materials,
setup, mesh and boundaries to a new project or save an existing one.
setup, mesh, and boundaries to a new project or save an existing one.
This code creates the JSON file:

.. code:: python
Expand Down
3 changes: 1 addition & 2 deletions examples/00-EDB/03_5G_antenna_example_parametrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ def points(self):
# ~~~~~~~~~~~~~~
# Launch HFSS 3D.

h3d = pyaedt.Hfss(specified_version="2023.2",new_desktop_session=True, close_on_exit=True, solution_type="Terminal")

h3d = pyaedt.Hfss(specified_version="2023.2", new_desktop_session=True, close_on_exit=True, solution_type="Terminal")

###############################################################################
# Add the layout component
Expand Down
6 changes: 5 additions & 1 deletion examples/00-EDB/13_edb_create_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@
###########################
# Save EDB and open in AEDT
# ~~~~~~~~~~~~~~~~~~~~~~~~~

edb.save_edb()
edb.close_edb()
h3d = pyaedt.Hfss3dLayout(specified_version="2023.2", projectname=aedb_path, non_graphical=False)
h3d = pyaedt.Hfss3dLayout(specified_version="2023.2",
projectname=aedb_path,
non_graphical=False,
new_desktop_session=True)
h3d.release_desktop(False, False)
6 changes: 3 additions & 3 deletions examples/00-EDB/14_edb_create_parametrized_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#############################
# Generated design parameters
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
#

edb.auto_parametrize_design(layers=True, materials=True, via_holes=True, pads=True, antipads=True, traces=True)
edb.save_edb()
Expand All @@ -65,5 +64,6 @@
# Open project in AEDT
# ~~~~~~~~~~~~~~~~~~~~

hfss = pyaedt.Hfss3dLayout(projectname=target_aedb, specified_version=aedt_version)
hfss.release_desktop(False, False)
# Uncomment the following line to open the design in HFSS 3D Layout
# hfss = pyaedt.Hfss3dLayout(projectname=target_aedb, specified_version=aedt_version, new_desktop_session=True)
# hfss.release_desktop()
15 changes: 7 additions & 8 deletions examples/02-HFSS/Array.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@

eep_file = ffdata.eep_files
frequencies = ffdata.frequencies
working_directory = hfss.working_directory

hfss.release_desktop()

Expand Down Expand Up @@ -148,12 +149,10 @@

ffdata.polar_plot_3d(farfield_quantity='RealizedGain')

##########################################################
# Generate 3D plots in PyVista
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Generate 3D plots in PyVista. You can define the Theta and Phi
# scan angles. You can change the easy-to-use interactive plot
# that is generated on the fly.
###############################################################################
# Analyze and release
# ~~~~~~~~~~~~~~~~~~~~
# Uncomment the ``hfss.analyze`` command if you want to analyze the
# model and release AEDT.

ffdata.polar_plot_3d_pyvista(farfield_quantity='RealizedGain',
show=False)
hfss.release_desktop()
1 change: 1 addition & 0 deletions examples/02-HFSS/Flex_CPWG.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def create_bending(radius, extension=0):
my_plot.plot(
os.path.join(hfss.working_directory, "Image.jpg"),
)

###############################################################################
# Analyze and release
# ~~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 5 additions & 0 deletions pyaedt/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,11 @@ def release_desktop(self, close_projects=True, close_on_exit=True):
>>> desktop.release_desktop(close_projects=False, close_on_exit=False) # doctest: +SKIP
"""
self.logger.oproject = None
self.logger.odesign = None
if os.getenv("PYAEDT_DOC_GENERATION", "False").lower() in ("true", "1", "t"): # pragma: no cover
close_projects = True
close_on_exit = True
if close_projects:
projects = self.odesktop.GetProjectList()
for project in projects:
Expand Down

0 comments on commit 56a3bc9

Please sign in to comment.