Skip to content

Commit db18ba2

Browse files
authored
Merge branch 'main' into update/06-Multiphysics
2 parents cf1c4b6 + 2e97033 commit db18ba2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1727
-1450
lines changed

.github/workflows/ci_cd.yml

+9-26
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ on:
1212
- cron: "0 3 * * *"
1313

1414
env:
15-
MAIN_PYTHON_VERSION: '3.10'
16-
PACKAGE_NAME: 'pyaedt-examples'
1715
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
16+
DOCUMENTATION_CNAME: 'examples.aedt.docs.pyansys.com'
17+
MAIN_PYTHON_VERSION: '3.10'
1818
ON_CI: True
19+
PACKAGE_NAME: 'pyaedt-examples'
1920
PYAEDT_NON_GRAPHICAL: '1'
2021
PYAEDT_DOC_GENERATION: '1'
2122

@@ -93,28 +94,10 @@ jobs:
9394
path: doc/_build/latex
9495
retention-days: 7
9596

96-
release:
97-
if: github.event_name == 'refs/heads/main' && !contains(github.ref, 'refs/tags')
98-
needs: [doc-build, doc-style]
99-
runs-on: ubuntu-latest
100-
steps:
101-
- uses: actions/checkout@v4
102-
103-
- uses: actions/download-artifact@v4
104-
105-
- name: Display structure of downloaded files
106-
run: ls -R
107-
108-
- name: Zip HTML documentation
109-
uses: vimtor/action-zip@v1.2
97+
- name: Deploy
98+
if: contains(github.ref, 'refs/heads/main')
99+
uses: ansys/actions/doc-deploy-dev@v4
110100
with:
111-
files: documentation-html
112-
dest: documentation-html.zip
113-
114-
- name: Release
115-
uses: softprops/action-gh-release@v2
116-
with:
117-
generate_release_notes: true
118-
files: |
119-
./documentation-html.zip
120-
./documentation-pdf/*.pdf
101+
cname: ${{ env.DOCUMENTATION_CNAME }}
102+
token: ${{ secrets.GITHUB_TOKEN }}
103+
doc-artifact-name: 'documentation-html'

doc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ help:
2323
@echo "Removing vtk to avoid conflicts with vtk-osmesa needed for CI/CD"; \
2424
pip uninstall --yes vtk; \
2525
@echo "Installing vtk-osmesa"; \
26-
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa==9.2.20230527.dev0; \
26+
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa; \
2727
fi
2828
@if [ "${ON_CI}" = "True" ] && [ "$$is_pypandoc_binary_installed" != "yes" ]; then \
2929
@echo "Removing pypandoc to avoid conflicts with pypandoc-binary needed for CI/CD"; \

doc/make.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if NOT "%is_vtk_osmesa_installed%" == "vtk-osmesa" if "%ON_CI%" == "true" (
2222
@ECHO ON
2323
echo "Installing vtk-osmesa"
2424
@ECHO OFF
25-
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa==9.2.20230527.dev0)
25+
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa)
2626
for /f %%i in ('pip freeze ^| findstr /c:"pypandoc_binary"') do set is_pypandoc_binary_installed=%%i
2727
if NOT "%is_pypandoc_binary_installed%" == "pypandoc_binary" if "%ON_CI%" == "true" (
2828
@ECHO ON

doc/source/conf.py

+4-100
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@
88
from pathlib import Path
99
from pprint import pformat
1010
from docutils.nodes import document
11-
12-
# import re
1311
import shutil
1412
from typing import Any
1513
from sphinx.application import Sphinx
16-
import sys
17-
import warnings
1814

19-
# from sphinx_gallery.sorting import FileNameSortKey
2015
from ansys_sphinx_theme import (
2116
ansys_favicon,
2217
ansys_logo_white,
2318
ansys_logo_white_cropped,
24-
# get_version_match,
2519
latex,
2620
pyansys_logo_black,
2721
watermark,
@@ -51,9 +45,6 @@
5145
cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com")
5246
release = version = "0.1.dev0"
5347

54-
# os.environ["PYAEDT_NON_GRAPHICAL"] = "1"
55-
# os.environ["PYAEDT_DOC_GENERATION"] = "1"
56-
5748
# -- Connect functions (hooks) to Sphinx events -----------------------------
5849

5950
class PrettyPrintDirective(Directive):
@@ -73,33 +64,6 @@ def run(self):
7364
return [addnodes.desc_name(text=member_name), addnodes.desc_content("", literal)]
7465

7566

76-
# Sphinx builder specific events hook
77-
78-
79-
def check_example_error(app: Sphinx, pagename: str, templatename:str , context:dict[str, Any], doctree: document):
80-
"""Log an error if the execution of an example as a notebook triggered an error.
81-
82-
Since the documentation build might not stop if the execution of a notebook triggered
83-
an error, we use a flag to log that an error is spotted in the html page context.
84-
"""
85-
# Check if the HTML contains an error message
86-
if pagename.startswith("examples") and not pagename.endswith("/index"):
87-
if any(
88-
map(
89-
lambda msg: msg in context["body"],
90-
[
91-
"UsageError",
92-
"NameError",
93-
"DeadKernelError",
94-
"NotebookError",
95-
"CellExecutionError",
96-
],
97-
)
98-
):
99-
logger.error(f"An error was detected in file {pagename}")
100-
app.builder.config.html_context["build_error"] = True
101-
102-
10367
# Sphinx generic event hooks
10468

10569

@@ -236,8 +200,8 @@ def check_build_finished_without_error(app: Sphinx, exception: None | Exception)
236200
exception : None or Exception
237201
Exception raised during the build process.
238202
"""
239-
if app.builder.config.html_context.get("build_error", False):
240-
logger.info("Build failed due to an error in html-page-context")
203+
if exception is not None:
204+
logger.error("Build failed due to an error.")
241205
exit(1)
242206

243207
def remove_doctree(app: Sphinx, exception: None | Exception):
@@ -270,8 +234,6 @@ def setup(app):
270234
Sphinx instance containing all the configuration for the documentation build.
271235
"""
272236
app.add_directive("pprint", PrettyPrintDirective)
273-
# Builder specific hook
274-
app.connect("html-page-context", check_example_error)
275237
# Builder inited hooks
276238
app.connect("builder-inited", copy_examples)
277239
app.connect("builder-inited", check_pandoc_installed)
@@ -343,20 +305,6 @@ def setup(app):
343305
# separating the parameter name and type",
344306
}
345307

346-
# numpydoc_validation_exclude = { # set of regex
347-
# r"\.AEDTMessageManager.add_message$", # bad SS05
348-
# r"\.Modeler3D\.create_choke$", # bad RT05
349-
# r"HistoryProps.", # bad RT05 because of the base class named OrderedDict
350-
# }
351-
352-
# # Add any paths that contain templates here, relative to this directory.
353-
# templates_path = ["_templates"]
354-
355-
# # disable generating the sphinx nested documentation
356-
# if "PYAEDT_CI_NO_AUTODOC" in os.environ:
357-
# templates_path.clear()
358-
359-
360308
# Copy button customization ---------------------------------------------------
361309
# exclude traditional Python prompts from the copied code
362310
copybutton_prompt_text = r">>> ?|\.\.\. "
@@ -370,21 +318,9 @@ def setup(app):
370318
# directories to ignore when looking for source files.
371319
# This pattern also affects html_static_path and html_extra_path.
372320
exclude_patterns = [
373-
# "_build",
374-
# "sphinx_boogergreen_theme_1",
375-
# "Thumbs.db",
376-
# ".DS_Store",
377-
# "*.txt",
378321
"conf.py",
379-
# "constants.py",
380322
]
381323

382-
# inheritance_graph_attrs = dict(rankdir="RL", size='"8.0, 10.0"', fontsize=14, ratio="compress")
383-
# inheritance_node_attrs = dict(
384-
# shape="ellipse", fontsize=14, height=0.75, color="dodgerblue1", style="filled"
385-
# )
386-
387-
388324
# -- Options for HTML output -------------------------------------------------
389325

390326
source_suffix = {".rst": "restructuredtext", ".md": "markdown"}
@@ -410,47 +346,15 @@ def setup(app):
410346
}
411347

412348
# Pyvista customization
413-
# pyvista.set_error_output_file("errors.txt")
414-
# Ensure that offscreen rendering is used for docs generation
415-
# pyvista.OFF_SCREEN = True
416-
# Preferred plotting style for documentation
417-
# pyvista.set_plot_theme('document')
418-
# must be less than or equal to the XVFB window size
349+
350+
# Must be less than or equal to the XVFB window size
419351
pyvista.global_theme["window_size"] = np.array([1024, 768])
420352

421353
# Save figures in specified directory
422354
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")
423355
if not os.path.exists(pyvista.FIGURE_PATH):
424356
os.makedirs(pyvista.FIGURE_PATH)
425357

426-
# # suppress annoying matplotlib bug
427-
# warnings.filterwarnings(
428-
# "ignore",
429-
# category=UserWarning,
430-
# message="Matplotlib is currently using agg so figures are not shown.",
431-
# )
432-
433-
# necessary for pyvista when building the sphinx gallery
434-
# pyvista.BUILDING_GALLERY = True
435-
436-
# jinja_contexts = {
437-
# "main_toctree": {
438-
# "run_examples": config["run_examples"],
439-
# },
440-
# }
441-
# def prepare_jinja_env(jinja_env) -> None:
442-
# """
443-
# Customize the jinja env.
444-
#
445-
# Notes
446-
# -----
447-
# See https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment
448-
# """
449-
# jinja_env.globals["project_name"] = project
450-
#
451-
#
452-
# autoapi_prepare_jinja_env = prepare_jinja_env
453-
454358
# -- Options for HTML output -------------------------------------------------
455359
html_short_title = html_title = "PyAEDT Examples"
456360
html_theme = "ansys_sphinx_theme"

examples/01-HFSS3DLayout/01_power_integrity.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# # HFSS 3D Layout: Power Integrity Analysis
22
# This example shows how to use the electronics database (EDB) for power integrity analysis. The
33
# EDB will be loaded into HFSS 3D Layout for analysis and post-processing.
4+
#
45
# - Set up EDB
6+
#
57
# - Assign S-parameter model to components
68
# - Create pin groups
79
# - Create ports
810
# - Create SIwave SYZ anaylsis
911
# - Create cutout
12+
#
1013
# - Import EDB into HFSS 3D Layout
14+
#
1115
# - Analyze
1216
# - Plot $Z_{11}$
1317

examples/01-HFSS3DLayout/02_dc_ir_analysis.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# # HFSS 3D Layout: DC IR Analysis
22
# This example shows how to configure EDB for DC IR analysis, and load EDB into the 3D Layout UI for analysis and
33
# post-processing.
4+
#
45
# - Set up EDB
6+
#
57
# - Edit via padstack
68
# - Assign SPICE model to components
79
# - Create pin groups
810
# - Create voltage and current sources
911
# - Create SIwave DC anaylsis
1012
# - Create cutout
13+
#
1114
# - Import EDB into HFSS 3D Layout
15+
#
1216
# - Analyze
1317
# - Get DC IR analysis results
1418

examples/01-HFSS3DLayout/04_pre_layout_sma_connector_on_pcb.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# # HFSS 3D Layout: Pre-layout Signal Integrity
22
# This example shows how to create a parameterized layout design, and load the layout into HFSS 3D Layout for analysis and
33
# post-processing.
4+
#
45
# - Create EDB
6+
#
57
# - Add material
68
# - Create stackup
79
# - Create a parameterized via padstack definition
@@ -10,7 +12,9 @@
1012
# - Create signal vias and traces
1113
# - Create ground stitching vias
1214
# - Create HFSS analysis setup and frequency sweep
15+
#
1316
# - Import EDB into HFSS 3D Layout
17+
#
1418
# - Place SMA connector
1519
# - Analysis
1620
# - Plot return loss

examples/01-Modeling-Setup/Configurations.py

+24-17
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,40 @@
2323
# any reason, this face position has changed or the object name in the target
2424
# design has changed, the boundary fails to apply.
2525

26-
# ## Perform required imports
26+
# ## Preparation
27+
# Import the required packages
2728

29+
# +
2830
import os
2931
import tempfile
32+
import time
3033

3134
import pyaedt
3235
from pyaedt.generic.general_methods import generate_unique_name
36+
# -
3337

34-
# Set constant values
38+
# Define constants
3539

3640
AEDT_VERSION = "2024.1"
37-
38-
# ## Set non-graphical mode
39-
40-
# You can set ``non_graphical`` either to ``True`` or ``False``.
41-
42-
non_graphical = False
41+
NG_MODE = False # Open Electronics UI when the application is launched.
4342

4443
# ## Create temporary directory
4544

46-
temp_dir = tempfile.TemporaryDirectory(suffix="_ansys")
45+
temp_dir = tempfile.TemporaryDirectory(suffix=".ansys")
4746

4847
# ## Download project
4948

5049
project_full_name = pyaedt.downloads.download_icepak(destination=temp_dir.name)
5150

5251
# ## Open project
53-
54-
# Open the project, and save it to the temporary folder.
52+
#
53+
# Open the Icepak project from the project folder.
5554

5655
ipk = pyaedt.Icepak(
5756
project=project_full_name,
5857
version=AEDT_VERSION,
5958
new_desktop=True,
60-
non_graphical=non_graphical,
59+
non_graphical=NG_MODE,
6160
)
6261
ipk.autosave_disable()
6362

@@ -99,23 +98,25 @@
9998
file_name=filename,
10099
file_path=ipk.working_directory,
101100
file_format=".step",
102-
object_list=[],
103-
removed_objects=[],
101+
assignment_to_export=[],
102+
assignment_to_remove=[],
104103
)
105104

106105
# ## Export configuration files
107106
#
108107
# Export the configuration files. You can optionally disable the export and
109108
# import sections. Supported formats are json and toml files
110109

111-
conf_file = ipk.configurations.export_config(os.path.join(ipk.working_directory, "config.toml"))
110+
conf_file = ipk.configurations.export_config(
111+
os.path.join(ipk.working_directory, "config.toml")
112+
)
112113
ipk.close_project()
113114

114115
# ## Create project
115116
#
116117
# Create an Icepak project and import the step.
117118

118-
new_project = os.path.join(temp_dir.name, generate_unique_name("example") + ".aedt")
119+
new_project = os.path.join(temp_dir.name, "example.aedt")
119120
app = pyaedt.Icepak(project=new_project)
120121
app.modeler.import_3d_cad(file_path)
121122

@@ -131,7 +132,13 @@
131132
# Close the project and release AEDT.
132133

133134
app.release_desktop()
135+
time.sleep(3) # Allow Electronics Desktop to shut down before cleaning the temporary project folder.
134136

135-
# ## Clean temporary directory
137+
# ## Cleanup
138+
#
139+
# All project files are saved in the folder ``temp_dir.name``.
140+
# If you've run this example as a Jupyter notebook you
141+
# can retrieve those project files. The following cell removes
142+
# all temporary files, including the project folder.
136143

137144
temp_dir.cleanup()

0 commit comments

Comments
 (0)