From 32e79ccf07e4bd06830da006a9bc729c44a5e45e Mon Sep 17 00:00:00 2001 From: ring630 <@gmail.com> Date: Tue, 25 Jun 2024 11:25:07 +0200 Subject: [PATCH] FEAT: new class Workflow --- ...t_up_edb_for_signal_integrity_analysis.py} | 16 ++++++------ src/pyedb/dotnet/edb.py | 5 ++++ src/pyedb/workflow.py | 25 +++++++++++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) rename examples/edb_cfg_examples/{setup_edb_for_signal_integrity_analysis.py => set_up_edb_for_signal_integrity_analysis.py} (95%) create mode 100644 src/pyedb/workflow.py diff --git a/examples/edb_cfg_examples/setup_edb_for_signal_integrity_analysis.py b/examples/edb_cfg_examples/set_up_edb_for_signal_integrity_analysis.py similarity index 95% rename from examples/edb_cfg_examples/setup_edb_for_signal_integrity_analysis.py rename to examples/edb_cfg_examples/set_up_edb_for_signal_integrity_analysis.py index 5c8b85e5dd..e9ec940a4d 100644 --- a/examples/edb_cfg_examples/setup_edb_for_signal_integrity_analysis.py +++ b/examples/edb_cfg_examples/set_up_edb_for_signal_integrity_analysis.py @@ -1,4 +1,4 @@ -# # Setup EDB for Power Integrity Analysis +# # Set up EDB for Power Integrity Analysis # This example shows how to set up the electronics database (EDB) for power integrity analysis from a single # configuration file. @@ -17,6 +17,7 @@ from pyedb import Edb +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") AEDT_VERSION = "2024.1" NG_MODE = False @@ -24,10 +25,13 @@ # Download the example PCB data. -temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") -aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name) download_file(source="touchstone", name="GRM32_DC0V_25degC_series.s2p", destination=temp_folder.name) +# Load example layout. + +edbapp = Edb(edbversion=AEDT_VERSION) +edbapp.workflow.get_si_verse(working_directory=temp_folder.name) + # ## Create a configuration file # In this example, we are going to use a configuration file to set up the layout for analysis. # ### Initialize a dictionary @@ -134,10 +138,6 @@ # ## Load configuration into EDB -# Load layout. - -edbapp = Edb(aedb, edbversion=AEDT_VERSION) - # Load configuration file edbapp.configuration.load(config_file=file_json) @@ -159,7 +159,7 @@ # ### Load edb into HFSS 3D Layout. -h3d = Hfss3dLayout(aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True) +h3d = Hfss3dLayout(edbapp.edbpath, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True) # ### Analyze diff --git a/src/pyedb/dotnet/edb.py b/src/pyedb/dotnet/edb.py index de35cfe64e..2749b98269 100644 --- a/src/pyedb/dotnet/edb.py +++ b/src/pyedb/dotnet/edb.py @@ -112,6 +112,7 @@ from pyedb.generic.settings import settings from pyedb.ipc2581.ipc2581 import Ipc2581 from pyedb.modeler.geometry_operators import GeometryOperators +from pyedb.workflow import Workflow if is_linux and is_ironpython: import subprocessdotnet as subprocess @@ -4456,3 +4457,7 @@ def definitions(self): from pyedb.dotnet.edb_core.definition.definitions import Definitions return Definitions(self) + + @property + def workflow(self): + return Workflow(self) diff --git a/src/pyedb/workflow.py b/src/pyedb/workflow.py new file mode 100644 index 0000000000..06e11ae46e --- /dev/null +++ b/src/pyedb/workflow.py @@ -0,0 +1,25 @@ +import tempfile +from pathlib import Path +from pyaedt.downloads import download_file + + +class Workflow: + def __init__(self, pedb): + self._pedb = pedb + + def get_si_verse(self, working_directory: [str, Path] = None): + """Download SI-verse demo board. + + Parameters + ---------- + working_directory + """ + if working_directory is None: + temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") + dst = temp_folder.name + else: + dst = str(working_directory) + aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", destination=dst) + self._pedb.close_edb() + self._pedb.edbpath = aedb + self._pedb.open_edb()