Skip to content

Commit

Permalink
WIP: all examples are working
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys committed Oct 18, 2023
1 parent 03d5ec3 commit 0ab5ddd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 24 deletions.
1 change: 0 additions & 1 deletion examples/legacy/05_Plot_nets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Perform required imports, which includes importing a section.

import os
import pyedb
from pyedb.legacy.downloads import download_file

Expand Down
9 changes: 4 additions & 5 deletions examples/legacy/10_GDS_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@

import os
import tempfile
import pyaedt
import shutil
from pyaedt.edb_core.edb_data.control_file import ControlFile
from pyedb import Edb
from pyedb.legacy.edb_core.edb_data.control_file import ControlFile
from pyedb.legacy.downloads import download_file

###############################################################################
# Download file
# ~~~~~~~~~~~~~
# Download the AEDB file and copy it in the temporary folder.
temppath = tempfile.gettempdir()
local_path = pyaedt.downloads.download_file('gds')
local_path = download_file('gds')
c_file_in = os.path.join(
local_path, "sky130_fictitious_dtc_example_control_no_map.xml"
)
Expand Down Expand Up @@ -86,8 +87,6 @@
# ~~~~~~~~~
# Import the gds and open the edb.

from pyaedt import Edb

edb = Edb(gds_out, edbversion="2023.2", technology_file=os.path.join(temppath, "output.xml"))

###############################################################################
Expand Down
16 changes: 9 additions & 7 deletions examples/legacy/11_post_layout_parameterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~
import os
import tempfile
import pyaedt
import pyedb
from pyedb.legacy.downloads import download_file
# import pyaedt

from pyaedt import downloads
from pyaedt import Edb
# from pyaedt import downloads
# from pyaedt import Edb

temppath = pyaedt.generate_unique_folder_name()
temppath = pyedb.generate_unique_folder_name()

###############################################################################
# Download and open example layout file in edb format
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
edb_fpath = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb',destination=temppath)
appedb = Edb(edb_fpath, edbversion="2023.2")
edb_fpath = download_file('edb/ANSYS-HSD_V1.aedb',destination=temppath)
appedb = pyedb.Edb(edb_fpath, edbversion="2023.2")

###############################################################################
# Cutout
Expand Down Expand Up @@ -87,7 +89,7 @@
# Save and close Edb
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

save_edb_fpath = os.path.join(temppath, pyaedt.generate_unique_name("post_layout_parameterization") + ".aedb")
save_edb_fpath = os.path.join(temppath, pyedb.generate_unique_name("post_layout_parameterization") + ".aedb")
appedb.save_edb_as(save_edb_fpath)
print("Edb is saved to ", save_edb_fpath)
appedb.close_edb()
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import pyedb
import os
from pyaedt import Hfss3dLayout

##########################################################
# Set non-graphical mode
Expand Down Expand Up @@ -281,7 +282,7 @@
# ~~~~~~~~~~~~~~~~
# Open EDB in AEDT.

h3d = pyaedt.Hfss3dLayout(projectname=aedb_path, specified_version="2023.2",
h3d = Hfss3dLayout(projectname=aedb_path, specified_version="2023.2",
non_graphical=non_graphical, new_desktop_session=True)

###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# on version 2023 R2.

import os
import pyaedt
import pyedb
from pyedb.legacy.downloads import download_file
from pyaedt import Hfss3dLayout

##########################################################
# Set non-graphical mode
Expand All @@ -28,16 +30,16 @@
# Download the AEDB file and copy it in the temporary folder.


project_path = pyaedt.generate_unique_folder_name()
target_aedb = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb', destination=project_path)
project_path = pyedb.generate_unique_folder_name()
target_aedb = download_file('edb/ANSYS-HSD_V1.aedb', destination=project_path)
print("Project folder will be", target_aedb)

###############################################################################
# Launch EDB
# ~~~~~~~~~~
# Launch the :class:`pyaedt.Edb` class, using EDB 2023 R2 and SI units.

edbapp = pyaedt.Edb(target_aedb, edbversion="2023.2")
edbapp = pyedb.Edb(target_aedb, edbversion="2023.2")
###############################################################################
# Import Definitions
# ~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -174,7 +176,7 @@
# Open Aedt
# ~~~~~~~~~
# Project folder aedb will be opened in AEDT Hfss3DLayout and loaded.
h3d = pyaedt.Hfss3dLayout(specified_version="2023.2", projectname=target_aedb, non_graphical=non_graphical, new_desktop_session=True)
h3d = Hfss3dLayout(specified_version="2023.2", projectname=target_aedb, non_graphical=non_graphical, new_desktop_session=True)

###############################################################################
# Analyze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@

import os
import numpy as np
import pyaedt
# import pyaedt
import pyedb
from pyedb.legacy.downloads import download_file
from pyaedt import Hfss3dLayout


ansys_version = "2023.2"

aedb_path = os.path.join(pyaedt.generate_unique_folder_name(), pyaedt.generate_unique_name("pcb") + ".aedb")
edb = pyaedt.Edb(edbpath=aedb_path, edbversion=ansys_version)
aedb_path = os.path.join(pyedb.generate_unique_folder_name(), pyedb.generate_unique_name("pcb") + ".aedb")
edb = pyedb.Edb(edbpath=aedb_path, edbversion=ansys_version)
print("EDB is located at {}".format(aedb_path))

#####################
Expand Down Expand Up @@ -168,13 +172,13 @@
# Launch Hfss3dLayout
# ~~~~~~~~~~~~~~~~~~~

h3d = pyaedt.Hfss3dLayout(aedb_path, specified_version=ansys_version, new_desktop_session=True)
h3d = Hfss3dLayout(aedb_path, specified_version=ansys_version, new_desktop_session=True)

####################
# Place 3D component
# ~~~~~~~~~~~~~~~~~~

component3d = pyaedt.downloads.download_file("component_3d", "SMA_RF_SURFACE_MOUNT.a3dcomp",)
component3d = download_file("component_3d", "SMA_RF_SURFACE_MOUNT.a3dcomp",)

comp = h3d.modeler.place_3d_component(
component_path=component3d, number_of_terminals=1, placement_layer="TOP", component_name="my_connector",
Expand Down

0 comments on commit 0ab5ddd

Please sign in to comment.