diff --git a/README.md b/README.md index 1216e528e..fc8e71a78 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,11 @@ The following guidelines help ensure that the examples are consistent, easy to r ``` Create a temporary folder at the beginning of the example: ``` - temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") + temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") ``` Remove the temporary folder at the end of the example: ``` - temp_dir.cleanup() + temp_folder.cleanup() ``` - The examples should be formatted, so they are compatible with [jupytext](https://jupytext.readthedocs.io/en/latest/) using the [light format](https://jupytext.readthedocs.io/en/latest/formats-scripts.html#the-light-format) and can diff --git a/examples/01-Modeling-Setup/Configurations.py b/examples/01-Modeling-Setup/Configurations.py index 0ab32234d..b956fcb1b 100644 --- a/examples/01-Modeling-Setup/Configurations.py +++ b/examples/01-Modeling-Setup/Configurations.py @@ -43,12 +43,18 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download project -project_full_name = ansys.aedt.core.downloads.download_icepak(destination=temp_dir.name) +project_full_name = ansys.aedt.core.downloads.download_icepak( + destination=temp_folder.name +) # ## Open project # @@ -118,7 +124,7 @@ # # Create an Icepak project and import the step. -new_project = os.path.join(temp_dir.name, "example.aedt") +new_project = os.path.join(temp_folder.name, "example.aedt") app = ansys.aedt.core.Icepak(version=AEDT_VERSION, project=new_project) app.modeler.import_3d_cad(file_path) @@ -140,9 +146,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/01-Modeling-Setup/CoordinateSystem.py b/examples/01-Modeling-Setup/CoordinateSystem.py index 70de7d77f..30f051733 100644 --- a/examples/01-Modeling-Setup/CoordinateSystem.py +++ b/examples/01-Modeling-Setup/CoordinateSystem.py @@ -18,9 +18,14 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT @@ -32,7 +37,7 @@ # # Insert an HFSS design with the default name. -project_name = os.path.join(temp_dir.name, "CoordSysDemo.aedt") +project_name = os.path.join(temp_folder.name, "CoordSysDemo.aedt") hfss = ansys.aedt.core.Hfss(version=AEDT_VERSION, project=project_name) # ## Create coordinate system @@ -289,7 +294,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/01-Modeling-Setup/Optimetrics.py b/examples/01-Modeling-Setup/Optimetrics.py index aa2e2b842..b72a79be5 100644 --- a/examples/01-Modeling-Setup/Optimetrics.py +++ b/examples/01-Modeling-Setup/Optimetrics.py @@ -19,9 +19,14 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Initialize HFSS and create variables # @@ -29,7 +34,7 @@ # ``w1`` and ``w2``. # + -project_name = os.path.join(temp_dir.name, "optimetrics.aedt") +project_name = os.path.join(temp_folder.name, "optimetrics.aedt") hfss = ansys.aedt.core.Hfss( project=project_name, @@ -151,9 +156,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/01-Modeling-Setup/Polyline_Primitives.py b/examples/01-Modeling-Setup/Polyline_Primitives.py index 9d2f31ca0..601df3aac 100644 --- a/examples/01-Modeling-Setup/Polyline_Primitives.py +++ b/examples/01-Modeling-Setup/Polyline_Primitives.py @@ -19,15 +19,20 @@ NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Create Maxwell 3D object # # Create a `Maxwell3d` object and set the unit type to ``"mm"``. -project_name = os.path.join(temp_dir.name, "polyline.aedt") +project_name = os.path.join(temp_folder.name, "polyline.aedt") maxwell = ansys.aedt.core.Maxwell3d( project=project_name, solution_type="Transient", @@ -339,9 +344,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/Array.py b/examples/02-HFSS/Array.py index 7d32c096e..9d07037c1 100644 --- a/examples/02-HFSS/Array.py +++ b/examples/02-HFSS/Array.py @@ -25,20 +25,26 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download 3D component # Download the 3D component that is needed to run the example. -example_path = ansys.aedt.core.downloads.download_3dcomponent(destination=temp_dir.name) +example_path = ansys.aedt.core.downloads.download_3dcomponent( + destination=temp_folder.name +) # ## Launch HFSS and open project # # Launch HFSS and open the project. # + -project_name = os.path.join(temp_dir.name, "array.aedt") +project_name = os.path.join(temp_folder.name, "array.aedt") hfss = ansys.aedt.core.Hfss( project=project_name, version=AEDT_VERSION, @@ -170,9 +176,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/Create_3d_Component_and_use_it.py b/examples/02-HFSS/Create_3d_Component_and_use_it.py index d838b4752..cb8f3f55f 100644 --- a/examples/02-HFSS/Create_3d_Component_and_use_it.py +++ b/examples/02-HFSS/Create_3d_Component_and_use_it.py @@ -25,9 +25,13 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# Create temporary directory +# ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # Create an HFSS object. @@ -37,7 +41,7 @@ close_on_exit=True, non_graphical=NG_MODE, ) -hfss.save_project(os.path.join(temp_dir.name, "example.aedt")) +hfss.save_project(os.path.join(temp_folder.name, "example.aedt")) # ## Variable definition # @@ -121,14 +125,14 @@ # Multiple options are available to partially select objects, cs, boundaries and mesh operations. # Furthermore, encrypted 3d comp can be created too. -component_path = os.path.join(temp_dir.name, "component_test.aedbcomp") +component_path = os.path.join(temp_folder.name, "component_test.aedbcomp") hfss.modeler.create_3dcomponent(component_path, "patch_antenna") # ## Multiple project management # # PyAEDT allows to control multiple projects, design and solution type at the same time. -new_project = os.path.join(temp_dir.name, "new_project.aedt") +new_project = os.path.join(temp_folder.name, "new_project.aedt") hfss2 = Hfss(version=AEDT_VERSION, project=new_project, design="new_design") # ## Insert 3D component @@ -195,9 +199,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/Flex_CPWG.py b/examples/02-HFSS/Flex_CPWG.py index 6a177c677..194361f25 100644 --- a/examples/02-HFSS/Flex_CPWG.py +++ b/examples/02-HFSS/Flex_CPWG.py @@ -27,9 +27,14 @@ non_graphical = False -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT # @@ -42,7 +47,7 @@ non_graphical=non_graphical, ) hfss.save_project( - os.path.join(temp_dir.name, generate_unique_name("example") + ".aedt") + os.path.join(temp_folder.name, generate_unique_name("example") + ".aedt") ) # ## Design settings @@ -246,4 +251,4 @@ def create_bending(radius, extension=0): # ## Clean temporary directory -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/HFSS_Choke.py b/examples/02-HFSS/HFSS_Choke.py index a765803d0..2f51e1463 100644 --- a/examples/02-HFSS/HFSS_Choke.py +++ b/examples/02-HFSS/HFSS_Choke.py @@ -20,13 +20,18 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch HFSS -project_name = os.path.join(temp_dir.name, "choke.aedt") +project_name = os.path.join(temp_folder.name, "choke.aedt") hfss = ansys.aedt.core.Hfss( project=project_name, version=AEDT_VERSION, @@ -256,9 +261,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/HFSS_Dipole.py b/examples/02-HFSS/HFSS_Dipole.py index ad6c30d0d..b1ac841fb 100644 --- a/examples/02-HFSS/HFSS_Dipole.py +++ b/examples/02-HFSS/HFSS_Dipole.py @@ -21,9 +21,14 @@ NUM_CORES = 4 NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT @@ -35,7 +40,7 @@ # # Create a new HFSS design. -project_name = os.path.join(temp_dir.name, "dipole.aedt") +project_name = os.path.join(temp_folder.name, "dipole.aedt") hfss = ansys.aedt.core.Hfss( version=AEDT_VERSION, project=project_name, solution_type="Modal" ) @@ -208,9 +213,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. # The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/HFSS_FSS_unitcell.py b/examples/02-HFSS/HFSS_FSS_unitcell.py index 384933c81..2c8725c20 100644 --- a/examples/02-HFSS/HFSS_FSS_unitcell.py +++ b/examples/02-HFSS/HFSS_FSS_unitcell.py @@ -21,13 +21,18 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT -project_name = os.path.join(temp_dir.name, "FSS.aedt") +project_name = os.path.join(temp_folder.name, "FSS.aedt") d = ansys.aedt.core.launch_desktop( AEDT_VERSION, non_graphical=NG_MODE, @@ -53,7 +58,7 @@ # Download the 3D component from the example data and insert the 3D Component. unitcell_3d_component_path = ansys.aedt.core.downloads.download_FSS_3dcomponent( - destination=temp_dir.name + destination=temp_folder.name ) unitcell_path = os.path.join(unitcell_3d_component_path, "FSS_unitcell_23R2.a3dcomp") comp = hfss.modeler.insert_3d_component(unitcell_path) @@ -154,9 +159,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/HFSS_Spiral.py b/examples/02-HFSS/HFSS_Spiral.py index 706df327c..2037b6d94 100644 --- a/examples/02-HFSS/HFSS_Spiral.py +++ b/examples/02-HFSS/HFSS_Spiral.py @@ -20,15 +20,20 @@ NUM_CORES = 4 NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch HFSS # # Create a new HFSS design and change the units to microns. -project_name = os.path.join(temp_dir.name, "spiral.aedt") +project_name = os.path.join(temp_folder.name, "spiral.aedt") hfss = ansys.aedt.core.Hfss( project=project_name, version=AEDT_VERSION, @@ -221,9 +226,9 @@ def create_line(pts): # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/HFSS_eigenmode.py b/examples/02-HFSS/HFSS_eigenmode.py index bf524caea..2e2e68ac1 100644 --- a/examples/02-HFSS/HFSS_eigenmode.py +++ b/examples/02-HFSS/HFSS_eigenmode.py @@ -42,15 +42,20 @@ NUM_CORES = 4 NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download 3D component # Download the 3D component that is needed to run the example. project_path = ansys.aedt.core.downloads.download_file( - "eigenmode", "emi_PCB_house.aedt", temp_dir.name + "eigenmode", "emi_PCB_house.aedt", temp_folder.name ) # ## Launch AEDT @@ -173,9 +178,9 @@ def find_resonance(): # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/Probe_Fed_Patch.py b/examples/02-HFSS/Probe_Fed_Patch.py index dd5e0cadf..40fecf996 100644 --- a/examples/02-HFSS/Probe_Fed_Patch.py +++ b/examples/02-HFSS/Probe_Fed_Patch.py @@ -25,15 +25,20 @@ NUM_CORES = 4 NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch HFSS # # Launch HFSS and change length units. -project_name = os.path.join(temp_dir.name, "patch.aedt") +project_name = os.path.join(temp_folder.name, "patch.aedt") hfss = ansys.aedt.core.Hfss( project=project_name, solution_type="Terminal", @@ -107,9 +112,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index 609e30d3f..984a59a75 100644 --- a/examples/02-HFSS/Waveguide_Filter.py +++ b/examples/02-HFSS/Waveguide_Filter.py @@ -50,13 +50,18 @@ new_thread = True # - -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ### Create the HFSS design -project_name = os.path.join(temp_dir.name, "waveguide.aedt") +project_name = os.path.join(temp_folder.name, "waveguide.aedt") hfss = ansys.aedt.core.Hfss( project=project_name, version=AEDT_VERSION, @@ -259,9 +264,9 @@ def place_iris(z_pos, dz, param_count): # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/03-Maxwell2D/Maxwell2D_Control_Program.py b/examples/03-Maxwell2D/Maxwell2D_Control_Program.py index d9ea82c20..52431db1a 100644 --- a/examples/03-Maxwell2D/Maxwell2D_Control_Program.py +++ b/examples/03-Maxwell2D/Maxwell2D_Control_Program.py @@ -99,7 +99,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_DCConduction.py b/examples/03-Maxwell2D/Maxwell2D_DCConduction.py index 4d97d8adf..0bf1f6136 100644 --- a/examples/03-Maxwell2D/Maxwell2D_DCConduction.py +++ b/examples/03-Maxwell2D/Maxwell2D_DCConduction.py @@ -312,7 +312,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_EC_Reduced_Matrix.py b/examples/03-Maxwell2D/Maxwell2D_EC_Reduced_Matrix.py index ac6d13eca..e1759682c 100644 --- a/examples/03-Maxwell2D/Maxwell2D_EC_Reduced_Matrix.py +++ b/examples/03-Maxwell2D/Maxwell2D_EC_Reduced_Matrix.py @@ -130,7 +130,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_Electrostatic.py b/examples/03-Maxwell2D/Maxwell2D_Electrostatic.py index 3ff3d6616..b77e9addd 100644 --- a/examples/03-Maxwell2D/Maxwell2D_Electrostatic.py +++ b/examples/03-Maxwell2D/Maxwell2D_Electrostatic.py @@ -226,7 +226,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_H_contour_opt1.py b/examples/03-Maxwell2D/Maxwell2D_H_contour_opt1.py index 08bab8874..402c48f74 100644 --- a/examples/03-Maxwell2D/Maxwell2D_H_contour_opt1.py +++ b/examples/03-Maxwell2D/Maxwell2D_H_contour_opt1.py @@ -131,7 +131,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_H_contour_opt2.py b/examples/03-Maxwell2D/Maxwell2D_H_contour_opt2.py index c151866e3..66fc15af1 100644 --- a/examples/03-Maxwell2D/Maxwell2D_H_contour_opt2.py +++ b/examples/03-Maxwell2D/Maxwell2D_H_contour_opt2.py @@ -146,7 +146,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_PMSynchronousMotor.py b/examples/03-Maxwell2D/Maxwell2D_PMSynchronousMotor.py index 3133a2e92..7fcdf8776 100644 --- a/examples/03-Maxwell2D/Maxwell2D_PMSynchronousMotor.py +++ b/examples/03-Maxwell2D/Maxwell2D_PMSynchronousMotor.py @@ -957,7 +957,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_Transient.py b/examples/03-Maxwell2D/Maxwell2D_Transient.py index 31c098a3d..f93e82336 100644 --- a/examples/03-Maxwell2D/Maxwell2D_Transient.py +++ b/examples/03-Maxwell2D/Maxwell2D_Transient.py @@ -170,7 +170,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell2D/Maxwell2D_transformer_LL.py b/examples/03-Maxwell2D/Maxwell2D_transformer_LL.py index f2845e2d1..e55327602 100644 --- a/examples/03-Maxwell2D/Maxwell2D_transformer_LL.py +++ b/examples/03-Maxwell2D/Maxwell2D_transformer_LL.py @@ -272,7 +272,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell3D/Maxwell3DTeam7.py b/examples/03-Maxwell3D/Maxwell3DTeam7.py index b6f25ed29..93d971be4 100644 --- a/examples/03-Maxwell3D/Maxwell3DTeam7.py +++ b/examples/03-Maxwell3D/Maxwell3DTeam7.py @@ -541,7 +541,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell3D/Maxwell3D_Choke.py b/examples/03-Maxwell3D/Maxwell3D_Choke.py index 83ec7e849..202b2cbee 100644 --- a/examples/03-Maxwell3D/Maxwell3D_Choke.py +++ b/examples/03-Maxwell3D/Maxwell3D_Choke.py @@ -273,7 +273,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell3D/Maxwell3D_Conductor.py b/examples/03-Maxwell3D/Maxwell3D_Conductor.py index 0c1127daa..5b67ed2ea 100644 --- a/examples/03-Maxwell3D/Maxwell3D_Conductor.py +++ b/examples/03-Maxwell3D/Maxwell3D_Conductor.py @@ -133,7 +133,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell3D/Maxwell3D_Segmentation.py b/examples/03-Maxwell3D/Maxwell3D_Segmentation.py index 1de671a47..47c81f616 100644 --- a/examples/03-Maxwell3D/Maxwell3D_Segmentation.py +++ b/examples/03-Maxwell3D/Maxwell3D_Segmentation.py @@ -115,7 +115,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell3D/Maxwell3D_Team3_bath_plate.py b/examples/03-Maxwell3D/Maxwell3D_Team3_bath_plate.py index 166c82362..76321657b 100644 --- a/examples/03-Maxwell3D/Maxwell3D_Team3_bath_plate.py +++ b/examples/03-Maxwell3D/Maxwell3D_Team3_bath_plate.py @@ -285,7 +285,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell3D/Maxwell3D_Transformer_Coreloss.py b/examples/03-Maxwell3D/Maxwell3D_Transformer_Coreloss.py index 87d0d9eec..18c61b899 100644 --- a/examples/03-Maxwell3D/Maxwell3D_Transformer_Coreloss.py +++ b/examples/03-Maxwell3D/Maxwell3D_Transformer_Coreloss.py @@ -141,7 +141,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/03-Maxwell3D/Maxwell3D_Transient_Fields_Export.py b/examples/03-Maxwell3D/Maxwell3D_Transient_Fields_Export.py index ad6668133..c228d6175 100644 --- a/examples/03-Maxwell3D/Maxwell3D_Transient_Fields_Export.py +++ b/examples/03-Maxwell3D/Maxwell3D_Transient_Fields_Export.py @@ -185,7 +185,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-Layout/hfss_3d_layout/01_power_integrity.py b/examples/04-Layout/hfss_3d_layout/01_power_integrity.py index 62c2615c1..72b669bf2 100644 --- a/examples/04-Layout/hfss_3d_layout/01_power_integrity.py +++ b/examples/04-Layout/hfss_3d_layout/01_power_integrity.py @@ -34,9 +34,16 @@ NUM_CORES = 4 NG_MODE = False # Open Electronics UI when the application is launched. -# Download the example PCB data. +# ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") + +# Download the example PCB data. + aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name) download_file( source="touchstone", @@ -202,7 +209,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-Layout/hfss_3d_layout/02_dc_ir_analysis.py b/examples/04-Layout/hfss_3d_layout/02_dc_ir_analysis.py index 26d3d70e7..78f29bff7 100644 --- a/examples/04-Layout/hfss_3d_layout/02_dc_ir_analysis.py +++ b/examples/04-Layout/hfss_3d_layout/02_dc_ir_analysis.py @@ -211,7 +211,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-Layout/hfss_3d_layout/03_gui_manipulation.py b/examples/04-Layout/hfss_3d_layout/03_gui_manipulation.py index d3f356d4b..3ded416bc 100644 --- a/examples/04-Layout/hfss_3d_layout/03_gui_manipulation.py +++ b/examples/04-Layout/hfss_3d_layout/03_gui_manipulation.py @@ -89,7 +89,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/04-Layout/hfss_3d_layout/07_import_gds.py b/examples/04-Layout/hfss_3d_layout/07_import_gds.py index 73a5dd11d..018d6481c 100644 --- a/examples/04-Layout/hfss_3d_layout/07_import_gds.py +++ b/examples/04-Layout/hfss_3d_layout/07_import_gds.py @@ -30,20 +30,24 @@ NUM_CORES = 4 NG_MODE = False # Open Electronics UI when the application is launched. -# Download the example data. +# ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") control_fn = download_file( source="gds", name="sky130_fictitious_dtc_example_control_no_map.xml", - destination=temp_dir.name, + destination=temp_folder.name, ) gds_fn = download_file( - source="gds", name="sky130_fictitious_dtc_example.gds", destination=temp_dir.name + source="gds", name="sky130_fictitious_dtc_example.gds", destination=temp_folder.name ) layer_map = download_file( - source="gds", name="dummy_layermap.map", destination=temp_dir.name + source="gds", name="dummy_layermap.map", destination=temp_folder.name ) # - @@ -96,7 +100,7 @@ # # After all settings are ready, you can write an XML file. -c.write_xml(os.path.join(temp_dir.name, "output.xml")) +c.write_xml(os.path.join(temp_folder.name, "output.xml")) # ## Open EDB # @@ -107,7 +111,7 @@ edbapp = Edb( gds_fn, edbversion=AEDT_VERSION, - technology_file=os.path.join(temp_dir.name, "output.xml"), + technology_file=os.path.join(temp_folder.name, "output.xml"), ) # - @@ -125,4 +129,4 @@ # Clean up the temporary folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/05-Icepak/icepak_3d_components_example.py b/examples/05-Icepak/icepak_3d_components_example.py index 46262070b..6a8c3da2e 100644 --- a/examples/05-Icepak/icepak_3d_components_example.py +++ b/examples/05-Icepak/icepak_3d_components_example.py @@ -251,7 +251,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-Icepak/icepak_csv_import.py b/examples/05-Icepak/icepak_csv_import.py index 0aae6f7f2..0e725b035 100644 --- a/examples/05-Icepak/icepak_csv_import.py +++ b/examples/05-Icepak/icepak_csv_import.py @@ -14,11 +14,10 @@ import time from pathlib import Path -import numpy as np -import pyvista as pv - import ansys.aedt.core import matplotlib as mpl +import numpy as np +import pyvista as pv from IPython.display import Image from matplotlib import cm from matplotlib import pyplot as plt @@ -173,12 +172,16 @@ obj.color = [0, 0, 0] obj.transparency = 0.9 -# Export the model image by creating a list of all objects that excludes "Region". This list is then passed to the `export_model_picture` function. This approach ensures that the exported image fitted to the PCB and its compoents. +# Export the model image by creating a list of all objects that excludes "Region". +# This list is then passed to the `export_model_picture` function. +# This approach ensures that the exported image fitted to the PCB and its components. obj_list_noregion = list(ipk.modeler.object_names) obj_list_noregion.remove("Region") export_file = os.path.join(temp_folder.name, "object_power_AEDTExport.jpg") -ipk.post.export_model_picture(export_file, selections=obj_list_noregion, width=1920, height=1080) +ipk.post.export_model_picture( + export_file, selections=obj_list_noregion, width=1920, height=1080 +) Image(export_file) # ### Plot model using pyAEDT @@ -188,7 +191,9 @@ # Export all models objects to .obj files. -f = ipk.post.export_model_obj(export_path=temp_folder.name, export_as_single_objects=True, air_objects=False) +f = ipk.post.export_model_obj( + export_path=temp_folder.name, export_as_single_objects=True, air_objects=False +) # Add objects to the PyVista plotter. These objects are either set to a black color or assigned scalar values, # allowing them to be visualized with a colormap. @@ -198,15 +203,21 @@ plotter.add_mesh(mesh=pv.read(file), color="black", opacity=opacity) else: mesh = pv.read(filename=file) - mesh["Power"] = np.full(shape=mesh.n_points, fill_value=power_budget[Path(file).stem]) + mesh["Power"] = np.full( + shape=mesh.n_points, fill_value=power_budget[Path(file).stem] + ) plotter.add_mesh(mesh=mesh, scalars="Power", cmap="viridis", opacity=opacity) # Add a label to the object with the maximum temperature max_pow_obj = "MP1" -plotter.add_point_labels(points=[ipk.modeler[max_pow_obj].top_face_z.center], - labels=[f"{max_pow_obj}, {power_budget[max_pow_obj]}W"], - point_size=20, font_size=30, text_color="red") +plotter.add_point_labels( + points=[ipk.modeler[max_pow_obj].top_face_z.center], + labels=[f"{max_pow_obj}, {power_budget[max_pow_obj]}W"], + point_size=20, + font_size=30, + text_color="red", +) # Export file @@ -218,11 +229,13 @@ ipk.save_project() ipk.release_desktop() -time.sleep(3) # Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. +time.sleep( + 3 +) # Wait 3 seconds to allow Electronics Desktop to shut down before cleaning the temporary directory. # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-Icepak/icepak_ecad_import.py b/examples/05-Icepak/icepak_ecad_import.py index 702c7370e..9219b078e 100644 --- a/examples/05-Icepak/icepak_ecad_import.py +++ b/examples/05-Icepak/icepak_ecad_import.py @@ -113,7 +113,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-Icepak/icepak_graphic_card_example.py b/examples/05-Icepak/icepak_graphic_card_example.py index f5d143cb9..7f3869853 100644 --- a/examples/05-Icepak/icepak_graphic_card_example.py +++ b/examples/05-Icepak/icepak_graphic_card_example.py @@ -306,7 +306,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/05-Icepak/icepak_sherlock_example.py b/examples/05-Icepak/icepak_sherlock_example.py index f764c5913..8bd7c37d5 100644 --- a/examples/05-Icepak/icepak_sherlock_example.py +++ b/examples/05-Icepak/icepak_sherlock_example.py @@ -235,7 +235,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/06-Q3D/Q2D_Example_CPWG.py b/examples/06-Q3D/Q2D_Example_CPWG.py index 10a75532d..b75a2a6e6 100644 --- a/examples/06-Q3D/Q2D_Example_CPWG.py +++ b/examples/06-Q3D/Q2D_Example_CPWG.py @@ -25,8 +25,10 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT and 2D Extractor # @@ -37,7 +39,7 @@ version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True, - project=os.path.join(temp_dir.name, "cpwg"), + project=os.path.join(temp_folder.name, "cpwg"), design="coplanar_waveguide", ) @@ -242,4 +244,4 @@ # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/06-Q3D/Q2D_Example_Stripline.py b/examples/06-Q3D/Q2D_Example_Stripline.py index 6b716b321..8295341ce 100644 --- a/examples/06-Q3D/Q2D_Example_Stripline.py +++ b/examples/06-Q3D/Q2D_Example_Stripline.py @@ -27,8 +27,10 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT and 2D Extractor # @@ -36,7 +38,7 @@ # uses SI units. q2d = ansys.aedt.core.Q2d( - project=os.path.join(temp_dir.name, "stripline"), + project=os.path.join(temp_folder.name, "stripline"), design="differential_stripline", version=AEDT_VERSION, non_graphical=False, @@ -242,7 +244,7 @@ # Get simulation results as a ``SolutionData`` object and plot as a jpg data = q2d.post.get_solution_data(expressions=plot_sources, context=matrix.name) -data.plot(snapshot_path=os.path.join(temp_dir.name, "plot.jpg")) +data.plot(snapshot_path=os.path.join(temp_folder.name, "plot.jpg")) # - @@ -260,4 +262,4 @@ # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/06-Q3D/Q3D_DC_IR.py b/examples/06-Q3D/Q3D_DC_IR.py index b0aa03bc5..d08eac129 100644 --- a/examples/06-Q3D/Q3D_DC_IR.py +++ b/examples/06-Q3D/Q3D_DC_IR.py @@ -25,25 +25,28 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") - +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Set up project files and path # # Download needed project file and set up temporary project directory. aedb_project = ansys.aedt.core.downloads.download_file( - "edb/ANSYS-HSD_V1.aedb", destination=temp_dir.name + "edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name ) coil = ansys.aedt.core.downloads.download_file( - source="inductance_3d_component", name="air_coil.a3dcomp", destination=temp_dir.name + source="inductance_3d_component", + name="air_coil.a3dcomp", + destination=temp_folder.name, ) res = ansys.aedt.core.downloads.download_file( - source="resistors", name="Res_0402.a3dcomp", destination=temp_dir.name + source="resistors", name="Res_0402.a3dcomp", destination=temp_folder.name ) project_name = "HSD" -output_edb = os.path.join(temp_dir.name, project_name + ".aedb") -output_q3d = os.path.join(temp_dir.name, project_name + "_q3d.aedt") +output_edb = os.path.join(temp_folder.name, project_name + ".aedb") +output_q3d = os.path.join(temp_folder.name, project_name + "_q3d.aedt") # ## Open EDB # @@ -181,7 +184,7 @@ show=False, assignment=objs_copper_names, plot_as_separate_objects=False, - output_file=os.path.join(temp_dir.name, "Q3D.jpg"), + output_file=os.path.join(temp_folder.name, "Q3D.jpg"), plot_air_objects=False, ) # - @@ -262,7 +265,7 @@ q3d.post.plot_field_from_fieldplot( plot1.name, - project_path=temp_dir.name, + project_path=temp_folder.name, mesh_plot=False, image_format="jpg", view="isometric", @@ -318,4 +321,4 @@ # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/06-Q3D/Q3D_Example_Busbars.py b/examples/06-Q3D/Q3D_Example_Busbars.py index 1d655cd05..1e86c4f8e 100644 --- a/examples/06-Q3D/Q3D_Example_Busbars.py +++ b/examples/06-Q3D/Q3D_Example_Busbars.py @@ -24,15 +24,17 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT and Q3D Extractor # # Launch AEDT 2024 R2 in graphical mode and launch Q3D Extractor. This example uses SI units. q3d = ansys.aedt.core.Q3d( - project=os.path.join(temp_dir.name, "busbar.aedt"), + project=os.path.join(temp_folder.name, "busbar.aedt"), version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True, @@ -84,7 +86,7 @@ q3d.plot( show=False, - output_file=os.path.join(temp_dir.name, "Q3D.jpg"), + output_file=os.path.join(temp_folder.name, "Q3D.jpg"), plot_air_objects=False, ) # - @@ -168,4 +170,4 @@ # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/06-Q3D/Q3D_from_EDB.py b/examples/06-Q3D/Q3D_from_EDB.py index 10d719018..2629156a6 100644 --- a/examples/06-Q3D/Q3D_from_EDB.py +++ b/examples/06-Q3D/Q3D_from_EDB.py @@ -25,20 +25,22 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Setup project files and path # # Download of needed project file and setup of temporary project directory. # + -project_dir = os.path.join(temp_dir.name, "edb") +project_dir = os.path.join(temp_folder.name, "edb") aedb_project = ansys.aedt.core.downloads.download_file( source="edb/ANSYS-HSD_V1.aedb", destination=project_dir ) -project_name = os.path.join(temp_dir.name, "HSD") +project_name = os.path.join(temp_folder.name, "HSD") output_edb = os.path.join(project_dir, project_name + ".aedb") output_q3d = os.path.join(project_dir, project_name + "_q3d.aedt") # - @@ -121,7 +123,7 @@ q3d.plot( show=False, assignment=["CLOCK_I2C_SCL", "CLOCK_I2C_SDA"], - output_file=os.path.join(temp_dir.name, "Q3D.jpg"), + output_file=os.path.join(temp_folder.name, "Q3D.jpg"), plot_air_objects=False, ) @@ -178,4 +180,4 @@ # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/07-SBR+/SBR_City_Import.py b/examples/07-SBR+/SBR_City_Import.py index 5b0f27cf0..7e7e3174a 100644 --- a/examples/07-SBR+/SBR_City_Import.py +++ b/examples/07-SBR+/SBR_City_Import.py @@ -22,14 +22,18 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch HFSS and open project # # Launch HFSS and open the project. -project_name = os.path.join(temp_dir.name, "city.aedt") +project_name = os.path.join(temp_folder.name, "city.aedt") app = ansys.aedt.core.Hfss( project=project_name, design="Ansys", @@ -80,7 +84,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/07-SBR+/SBR_Doppler_Example.py b/examples/07-SBR+/SBR_Doppler_Example.py index e13a3886c..30a06e4f3 100644 --- a/examples/07-SBR+/SBR_Doppler_Example.py +++ b/examples/07-SBR+/SBR_Doppler_Example.py @@ -22,19 +22,25 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download 3D component # Download the 3D component that is needed to run the example. -library_path = ansys.aedt.core.downloads.download_multiparts(destination=temp_dir.name) +library_path = ansys.aedt.core.downloads.download_multiparts( + destination=temp_folder.name +) # ## Launch HFSS and open project # # Launch HFSS and open the project. -project_name = os.path.join(temp_dir.name, "doppler.aedt") +project_name = os.path.join(temp_folder.name, "doppler.aedt") app = ansys.aedt.core.Hfss( version=AEDT_VERSION, solution_type="SBR+", @@ -177,7 +183,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/07-SBR+/SBR_Example.py b/examples/07-SBR+/SBR_Example.py index e4b59c801..687382ab8 100644 --- a/examples/07-SBR+/SBR_Example.py +++ b/examples/07-SBR+/SBR_Example.py @@ -23,12 +23,16 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download project -project_full_name = ansys.aedt.core.downloads.download_sbr(destination=temp_dir.name) +project_full_name = ansys.aedt.core.downloads.download_sbr(destination=temp_folder.name) # ## Define designs # @@ -135,7 +139,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/07-SBR+/SBR_Time_Plot.py b/examples/07-SBR+/SBR_Time_Plot.py index a2142c85a..3b0408770 100644 --- a/examples/07-SBR+/SBR_Time_Plot.py +++ b/examples/07-SBR+/SBR_Time_Plot.py @@ -23,13 +23,17 @@ # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download project -project_file = downloads.download_sbr_time(destination=temp_dir.name) +project_file = downloads.download_sbr_time(destination=temp_folder.name) # ## Launch HFSS and analyze @@ -95,7 +99,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Circuit_AMI.py b/examples/08-Circuit/Circuit_AMI.py index 3c450a82c..36602b6c9 100644 --- a/examples/08-Circuit/Circuit_AMI.py +++ b/examples/08-Circuit/Circuit_AMI.py @@ -28,8 +28,12 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download Example Data # @@ -45,7 +49,7 @@ # Files are placed in the destination folder. project_path = ansys.aedt.core.downloads.download_file( - "ami", name="ami_usb.aedtz", destination=temp_dir.name + "ami", name="ami_usb.aedtz", destination=temp_folder.name ) @@ -323,7 +327,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Circuit_Example.py b/examples/08-Circuit/Circuit_Example.py index 46d9068ec..a1f0fccca 100644 --- a/examples/08-Circuit/Circuit_Example.py +++ b/examples/08-Circuit/Circuit_Example.py @@ -26,8 +26,12 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT # @@ -49,7 +53,7 @@ # + circuit = ansys.aedt.core.Circuit( - project=os.path.join(temp_dir.name, "CircuitExample"), + project=os.path.join(temp_folder.name, "CircuitExample"), design="Simple", version=AEDT_VERSION, non_graphical=NG_MODE, @@ -155,7 +159,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Circuit_Siwave_Multizones.py b/examples/08-Circuit/Circuit_Siwave_Multizones.py index da7654aaf..2fe7c9c22 100644 --- a/examples/08-Circuit/Circuit_Siwave_Multizones.py +++ b/examples/08-Circuit/Circuit_Siwave_Multizones.py @@ -22,17 +22,24 @@ EDB_VERSION = "2024.2" +# ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. + +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") + # ## Download file # # Download the EDB folder. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys", ignore_cleanup_errors=True) edb_file = ansys.aedt.core.downloads.download_file( - directory="edb/siwave_multi_zones.aedb", destination=temp_dir.name + directory="edb/siwave_multi_zones.aedb", destination=temp_folder.name ) -work_folder = os.path.join(temp_dir.name, "work") +work_folder = os.path.join(temp_folder.name, "work") aedt_file = os.path.splitext(edb_file)[0] + ".aedt" -circuit_project_file = os.path.join(temp_dir.name, "multizone_clipped_circuit.aedt") +circuit_project_file = os.path.join(temp_folder.name, "multizone_clipped_circuit.aedt") print(edb_file) @@ -134,7 +141,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Circuit_Subcircuit_Example.py b/examples/08-Circuit/Circuit_Subcircuit_Example.py index 603baa21c..b0ccc42e6 100644 --- a/examples/08-Circuit/Circuit_Subcircuit_Example.py +++ b/examples/08-Circuit/Circuit_Subcircuit_Example.py @@ -22,15 +22,19 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT with Circuit # # Launch AEDT in graphical mode. Instantite an instance of the ``Circuit`` class. circuit = ansys.aedt.core.Circuit( - project=os.path.join(temp_dir.name, "SubcircuitExampl.aedt"), + project=os.path.join(temp_folder.name, "SubcircuitExampl.aedt"), design="SimpleExample", version=AEDT_VERSION, non_graphical=NG_MODE, @@ -78,7 +82,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Circuit_Transient.py b/examples/08-Circuit/Circuit_Transient.py index 499fa47de..858f597df 100644 --- a/examples/08-Circuit/Circuit_Transient.py +++ b/examples/08-Circuit/Circuit_Transient.py @@ -25,16 +25,21 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT with Circuit # # Launch AEDT in graphical mode with the Circuit schematic editor. circuit = ansys.aedt.core.Circuit( - project=os.path.join(temp_dir.name, "CktTransient"), + project=os.path.join(temp_folder.name, "CktTransient"), design="Circuit Examples", version=AEDT_VERSION, new_desktop=True, @@ -203,7 +208,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Create_Netlist.py b/examples/08-Circuit/Create_Netlist.py index 3d369f7c8..5f6a69b68 100644 --- a/examples/08-Circuit/Create_Netlist.py +++ b/examples/08-Circuit/Create_Netlist.py @@ -26,17 +26,21 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT with Circuit # # Launch AEDT with Circuit. The `ansys.aedt.core.Desktop` class initializes AEDT # and starts it on the specified version in the specified graphical mode. -netlist = ansys.aedt.core.downloads.download_netlist(destination=temp_dir.name) +netlist = ansys.aedt.core.downloads.download_netlist(destination=temp_folder.name) circuit = ansys.aedt.core.Circuit( - project=os.path.join(temp_dir.name, "NetlistExample"), + project=os.path.join(temp_folder.name, "NetlistExample"), version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True, @@ -67,7 +71,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Results.py b/examples/08-Circuit/Results.py index f85f2cc22..afced51f3 100644 --- a/examples/08-Circuit/Results.py +++ b/examples/08-Circuit/Results.py @@ -25,8 +25,12 @@ NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT with the Circuit Interface # @@ -45,7 +49,7 @@ # + project_path = ansys.aedt.core.downloads.download_file( - source="custom_reports/", destination=temp_dir.name + source="custom_reports/", destination=temp_folder.name ) circuit = ansys.aedt.core.Circuit( @@ -138,7 +142,7 @@ # ## Save project and close AEDT # # Save the project and close AEDT. The example has finished running. Project files can be retrieved -# from ``temp_dir.name``. +# from ``temp_folder.name``. circuit.save_project() print("Project Saved in {}".format(circuit.project_path)) @@ -151,4 +155,4 @@ # The following cell cleans up the temporary directory and # removes all project files. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/08-Circuit/Virtual_Compliance.py b/examples/08-Circuit/Virtual_Compliance.py index 2520b8a66..fb305b76b 100644 --- a/examples/08-Circuit/Virtual_Compliance.py +++ b/examples/08-Circuit/Virtual_Compliance.py @@ -242,7 +242,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/09-Multiphysics/Hfss_Icepak_Coupling.py b/examples/09-Multiphysics/Hfss_Icepak_Coupling.py index eb7899790..bf6e1d723 100644 --- a/examples/09-Multiphysics/Hfss_Icepak_Coupling.py +++ b/examples/09-Multiphysics/Hfss_Icepak_Coupling.py @@ -22,11 +22,14 @@ NUM_CORES = 4 NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files # -# Create temporary directory. +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT and initialize HFSS # @@ -34,7 +37,7 @@ # object is linked to it. Otherwise, a new design is created. hfss = ansys.aedt.core.Hfss( - project=os.path.join(temp_dir.name, "Icepak_HFSS_Coupling"), + project=os.path.join(temp_folder.name, "Icepak_HFSS_Coupling"), design="RF", version=AEDT_VERSION, non_graphical=NG_MODE, @@ -280,7 +283,7 @@ hfss.post.plot_field_from_fieldplot( plot1.name, - project_path=temp_dir.name, + project_path=temp_folder.name, mesh_plot=False, image_format="jpg", view="isometric", @@ -306,14 +309,14 @@ plot_type="CutPlane", setup=hfss.nominal_adaptive, intrinsics=intrinsic, - export_path=temp_dir.name, + export_path=temp_folder.name, variation_variable="Phase", variations=phase_values, show=False, export_gif=False, log_scale=True, ) -animated.gif_file = os.path.join(temp_dir.name, "animate.gif") +animated.gif_file = os.path.join(temp_folder.name, "animate.gif") # Set off_screen to False to visualize the animation. # animated.off_screen = False @@ -352,7 +355,7 @@ x_label="Frequency (Ghz)", y_label="SParameters(dB)", title="Scattering Chart", - snapshot_path=os.path.join(temp_dir.name, "Touchstone_from_matplotlib.jpg"), + snapshot_path=os.path.join(temp_folder.name, "Touchstone_from_matplotlib.jpg"), ) # Create a PDF report summarizig results. @@ -372,7 +375,7 @@ pdf_report.add_sub_chapter("Field Plot") pdf_report.add_text("This section contains Field plots of Hfss Coaxial.") pdf_report.add_image( - os.path.join(temp_dir.name, plot1.name + ".jpg"), caption="Coaxial Cable" + os.path.join(temp_folder.name, plot1.name + ".jpg"), caption="Coaxial Cable" ) # Add a page break and a subchapter for S Parameter results @@ -387,7 +390,7 @@ title="S-Parameters", ) pdf_report.add_image( - path=os.path.join(temp_dir.name, "Touchstone_from_matplotlib.jpg"), + path=os.path.join(temp_folder.name, "Touchstone_from_matplotlib.jpg"), caption="Touchstone from Matplotlib", ) @@ -401,7 +404,7 @@ # Add table of content and save PDF. pdf_report.add_toc() -pdf_report.save_pdf(file_path=temp_dir.name, file_name="AEDT_Results.pdf") +pdf_report.save_pdf(file_path=temp_folder.name, file_name="AEDT_Results.pdf") # ## Release AEDT # @@ -414,7 +417,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/09-Multiphysics/MRI.py b/examples/09-Multiphysics/MRI.py index 4a4406311..9dc7025ab 100644 --- a/examples/09-Multiphysics/MRI.py +++ b/examples/09-Multiphysics/MRI.py @@ -33,11 +33,14 @@ NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files # -# Create temporary directory. +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Project load @@ -49,7 +52,7 @@ # Separate objects are used to selectively assign mesh operations # Material properties defined in this project already contain electrical and thermal properties. -project_path = downloads.download_file(source="mri", destination=temp_dir.name) +project_path = downloads.download_file(source="mri", destination=temp_folder.name) project_name = os.path.join(project_path, "background_SAR.aedt") hfss = Hfss( project=project_name, @@ -361,7 +364,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/09-Multiphysics/Maxwell_Icepak_Wireless_Charging.py b/examples/09-Multiphysics/Maxwell_Icepak_Wireless_Charging.py index 853c79d26..3adfaeefa 100644 --- a/examples/09-Multiphysics/Maxwell_Icepak_Wireless_Charging.py +++ b/examples/09-Multiphysics/Maxwell_Icepak_Wireless_Charging.py @@ -24,14 +24,14 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary folder +# ## Create temporary directory and download files # -# Simulation data will be saved in the temporary folder. -# If you run this example as a Jupyter Notebook, -# the results and project data can be retrieved before executing the -# final cell of the notebook. +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch Application # @@ -41,7 +41,7 @@ # this text as needed for your example. # + -project_name = os.path.join(temp_dir.name, "Maxwell-Icepak-2way-Coupling") +project_name = os.path.join(temp_folder.name, "Maxwell-Icepak-2way-Coupling") maxwell_design_name = "1 Maxwell" icepak_design_name = "2 Icepak" @@ -325,9 +325,9 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes # all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/10-EMIT/ComputeInterferenceType.py b/examples/10-EMIT/ComputeInterferenceType.py index 8bb059770..080ce0024 100644 --- a/examples/10-EMIT/ComputeInterferenceType.py +++ b/examples/10-EMIT/ComputeInterferenceType.py @@ -54,8 +54,12 @@ def install(package): # - # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # Check that EMIT version 2023.2 or greater is installed. @@ -66,7 +70,7 @@ def install(package): # Download project project_name = ansys.aedt.core.downloads.download_file( - "emit", "interference.aedtz", destination=temp_dir.name + "emit", "interference.aedtz", destination=temp_folder.name ) # ## Launch EMIT and open project @@ -243,9 +247,9 @@ def create_legend_table(): # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/10-EMIT/ComputeProtectionLevels.py b/examples/10-EMIT/ComputeProtectionLevels.py index 6a447894a..447b01a9f 100644 --- a/examples/10-EMIT/ComputeProtectionLevels.py +++ b/examples/10-EMIT/ComputeProtectionLevels.py @@ -56,8 +56,12 @@ def install(package): import plotly.graph_objects as go # ## Create temporary directory +# +# Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT with EMIT # @@ -70,7 +74,7 @@ def install(package): print("Warning: this example requires AEDT 2023.2 or later.") sys.exit() -project_name = os.path.join(temp_dir.name, "emit.aedt") +project_name = os.path.join(temp_folder.name, "emit.aedt") emitapp = Emit( non_graphical=NG_MODE, new_desktop=True, project=project_name, version=AEDT_VERSION @@ -304,7 +308,7 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios): # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/10-EMIT/EMIT_Example.py b/examples/10-EMIT/EMIT_Example.py index 2ae948878..eb2949db4 100644 --- a/examples/10-EMIT/EMIT_Example.py +++ b/examples/10-EMIT/EMIT_Example.py @@ -32,9 +32,14 @@ non_graphical = False -# ## Create temporary directory +# ## Create temporary directory and download files +# +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT with EMIT # @@ -43,7 +48,7 @@ # run AEDT in non-graphical mode. project_name = ansys.aedt.core.generate_unique_project_name( - rootname=temp_dir.name, project_name="antenna_cosite" + rootname=temp_folder.name, project_name="antenna_cosite" ) d = ansys.aedt.core.launch_desktop(AEDT_VERSION, non_graphical, True) aedtapp = ansys.aedt.core.Emit(project_name, version=AEDT_VERSION) @@ -106,7 +111,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/10-EMIT/EMIT_HFSS_Example.py b/examples/10-EMIT/EMIT_HFSS_Example.py index e5868ec3f..8c4f53e12 100644 --- a/examples/10-EMIT/EMIT_HFSS_Example.py +++ b/examples/10-EMIT/EMIT_HFSS_Example.py @@ -30,11 +30,14 @@ AEDT_VERSION = "2024.2" NG_MODE = False # Open Electronics UI when the application is launched. -# ## Create temporary directory +# ## Create temporary directory and download files # -# Create temporary directory. +# Create a temporary directory where we store downloaded data or +# dumped data. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT with EMIT # @@ -76,13 +79,13 @@ # Copy the files to the temporary working directory. project_name = shutil.copyfile( - example_project, os.path.join(temp_dir.name, file_name(example)) + example_project, os.path.join(temp_folder.name, file_name(example)) ) results_folder = shutil.copytree( - example_results_folder, os.path.join(temp_dir.name, results_name(example)) + example_results_folder, os.path.join(temp_folder.name, results_name(example)) ) project_pdf = shutil.copyfile( - example_pdf, os.path.join(temp_dir.name, pdf_name(example)) + example_pdf, os.path.join(temp_folder.name, pdf_name(example)) ) # Open the project in the working directory. @@ -142,7 +145,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/11-twin_builder/dynamic_rom_creation_and_visualization.py b/examples/11-twin_builder/dynamic_rom_creation_and_visualization.py index 2c1168237..bf1e24a8d 100644 --- a/examples/11-twin_builder/dynamic_rom_creation_and_visualization.py +++ b/examples/11-twin_builder/dynamic_rom_creation_and_visualization.py @@ -29,8 +29,10 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Set up input data # @@ -44,10 +46,10 @@ _ = ansys.aedt.core.downloads.download_twin_builder_data( file_name=source_snapshot_data_zipfilename, force_download=True, - destination=temp_dir.name, + destination=temp_folder.name, ) source_data_folder = ansys.aedt.core.downloads.download_twin_builder_data( - source_build_conf_file, True, temp_dir.name + source_build_conf_file, True, temp_folder.name ) # Toggle these for local testing @@ -69,7 +71,7 @@ # Launch Twin Builder using an implicit declaration and add a new design with # a default setup for building the dynamic ROM component. -project_name = os.path.join(temp_dir.name, "dynamic_rom.aedt") +project_name = os.path.join(temp_folder.name, "dynamic_rom.aedt") tb = ansys.aedt.core.TwinBuilder( project=project_name, version=AEDT_VERSION, @@ -206,7 +208,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/11-twin_builder/rc_circuit.py b/examples/11-twin_builder/rc_circuit.py index 3bd18e742..f07fc9be9 100644 --- a/examples/11-twin_builder/rc_circuit.py +++ b/examples/11-twin_builder/rc_circuit.py @@ -24,15 +24,17 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch Twin Builder # # Launch Twin Builder using an implicit declaration and add a new design with # a default setup. -project_name = os.path.join(temp_dir.name, "rc_circuit.aedt") +project_name = os.path.join(temp_folder.name, "rc_circuit.aedt") tb = ansys.aedt.core.TwinBuilder( project=project_name, version=AEDT_VERSION, @@ -101,7 +103,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/11-twin_builder/static_rom_creation_and_visualization.py b/examples/11-twin_builder/static_rom_creation_and_visualization.py index 2d45902f1..342bd013e 100644 --- a/examples/11-twin_builder/static_rom_creation_and_visualization.py +++ b/examples/11-twin_builder/static_rom_creation_and_visualization.py @@ -27,8 +27,10 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Set up input data # @@ -48,12 +50,12 @@ _ = downloads.download_twin_builder_data( file_name=source_snapshot_data_zipfilename, force_download=True, - destination=temp_dir.name, + destination=temp_folder.name, ) -_ = downloads.download_twin_builder_data(source_build_conf_file, True, temp_dir.name) +_ = downloads.download_twin_builder_data(source_build_conf_file, True, temp_folder.name) source_data_folder = downloads.download_twin_builder_data( - source_props_conf_file, True, temp_dir.name + source_props_conf_file, True, temp_folder.name ) # Target folder to extract project files. @@ -78,7 +80,7 @@ # Launch Twin Builder using an implicit declaration and add a new design with # a default setup for building the static ROM component. -project_name = os.path.join(temp_dir.name, "static_rom.aedt") +project_name = os.path.join(temp_folder.name, "static_rom.aedt") tb = TwinBuilder( project=project_name, version=AEDT_VERSION, @@ -218,7 +220,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/11-twin_builder/wiring_rectifier.py b/examples/11-twin_builder/wiring_rectifier.py index 002468ea9..69faac387 100644 --- a/examples/11-twin_builder/wiring_rectifier.py +++ b/examples/11-twin_builder/wiring_rectifier.py @@ -27,15 +27,17 @@ # ## Create temporary directory # # Create temporary directory. +# If you'd like to retrieve the project data for subsequent use, +# the temporary folder name is given by ``temp_folder.name``. -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch Twin Builder # # Launch Twin Builder using an implicit declaration and add a new design with # a default setup. -project_name = os.path.join(temp_dir.name, "TB_Rectifier_Demo.aedt") +project_name = os.path.join(temp_folder.name, "TB_Rectifier_Demo.aedt") tb = ansys.aedt.core.TwinBuilder( project=project_name, version=AEDT_VERSION, @@ -181,7 +183,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell removes all temporary files, including the project folder. -temp_dir.cleanup() +temp_folder.cleanup() diff --git a/examples/12-general/convert_model_version.py b/examples/12-general/convert_model_version.py index 29607537c..9fb00ac80 100644 --- a/examples/12-general/convert_model_version.py +++ b/examples/12-general/convert_model_version.py @@ -99,7 +99,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder. diff --git a/examples/template.py b/examples/template.py index 1f5d14cef..43c3eb363 100644 --- a/examples/template.py +++ b/examples/template.py @@ -35,7 +35,7 @@ # ## Launch AEDT and application # -# Create an instance of the application (i.e. ``Maxwell3d``,``Hfss`` etc) +# Create an instance of the application (i.e. ``Maxwell3d``,``Hfss`` etc.) # class named (``m3d``,``hfss`` etc.) by providing # the project and design names, the solver, and the version. @@ -56,15 +56,12 @@ # Add as many sections as needed for pre-processing tasks. - # ## Post-Processing # # Description of post-processing task. # Add as many sections as needed for post-processing tasks. - - # ## Release AEDT m3d.save_project() @@ -74,7 +71,7 @@ # ## Cleanup # -# All project files are saved in the folder ``temp_dir.name``. +# All project files are saved in the folder ``temp_folder.name``. # If you've run this example as a Jupyter notebook you # can retrieve those project files. The following cell # removes all temporary files, including the project folder.