Download this example
Download this example as a Jupyter Notebook or as a Python script.
GDS Import#
Integrated circuit layout data is defined in GDS data which specifies the layout geometry. Additionally, layer mapping and layer material information is defined in a technology file.
This example demonstrates how to import GDS files and translate GDS data into an EDB file along with some simplified technology data for subsequent use in HFSS 3D Layout.
Keywords: GDS, RFIC
Prerequisites#
Perform imports#
[1]:
import os
import tempfile
from pyedb.dotnet.edb import Edb
from pyedb.misc.downloads import download_file
from ansys.aedt.core.hfss3dlayout import Hfss3dLayout
Define constants#
Constants help ensure consistency and avoid repetition throughout the example.
[2]:
AEDT_VERSION = "2025.1"
NG_MODE = False # Open AEDT UI when it is launched.
Create temporary directory#
Create a temporary working directory. The name of the working folder is stored in temp_folder.name
.
Note: The final cell in the notebook cleans up the temporary folder. If you want to retrieve the AEDT project and data, do so before executing the final cell in the notebook.
[3]:
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
Import a GDS file.#
Download the test case folder and copy it to the working directory. The method download_file()
retrieves example data from the Ansys GitHub “example_data” repository.
The following files are used in this example:
Model.xml
defines physical information such as material properties, stackup layer names, and boundary conditions.Model.gds
contains the GDS data for the layout.Model.map
maps properties to stackup layers.
[4]:
control_fn = "Model.xml"
gds_fn = "Model.gds"
layer_map = "Model.map"
local_path = download_file("gds", destination=temp_folder.name)
control_file = os.path.join(local_path, control_fn)
map_file = os.path.join(local_path, layer_map)
gds_in = os.path.join(local_path, gds_fn)
Open the EDB#
Each GDS file requires a control file (XML) or a technology file (IRCX, VLC.TECH, or ITF) that maps the GDS geometry to a physical layer in the stackup. The MAP file is also regularly used to map the stackup layers, and finally in some cases a layer filter (XML) is deployed, when only a part of the stackup is needed.
Open the EDB by creating an instance of the Edb
class.
[5]:
edb = Edb(gds_in, edbversion=AEDT_VERSION, control_file=control_file, map_file=map_file)
PyEDB INFO: StdOut is enabled
PyAEDT INFO: StdOut is enabled
PyEDB INFO: Logger is initialized in EDB.
PyAEDT INFO: Logger is initialized in EDB.
PyEDB INFO: legacy v0.50.1
PyAEDT INFO: legacy v0.50.1
PyEDB INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyEDB INFO: Translation correctly completed
PyAEDT INFO: Translation correctly completed
PyEDB INFO: Database Model.aedb Opened in 2025.1
PyAEDT INFO: Database Model.aedb Opened in 2025.1
PyEDB INFO: Cell IC_Wo_Component1 Opened
PyAEDT INFO: Cell IC_Wo_Component1 Opened
PyEDB INFO: Builder was initialized.
PyAEDT INFO: Builder was initialized.
PyEDB INFO: EDB C:\Users\ansys\AppData\Local\Temp\tmpdnvvq0t7.ansys\gds\Model.aedb was created correctly from ds file.
PyAEDT INFO: EDB C:\Users\ansys\AppData\Local\Temp\tmpdnvvq0t7.ansys\gds\Model.aedb was created correctly from ds file.
PyEDB INFO: EDB initialized.
PyAEDT INFO: EDB initialized.
View the layer stackup#
[6]:
edb.stackup.plot()

[6]:
<module 'matplotlib.pyplot' from 'C:\\actions-runner\\_work\\pyaedt-examples\\pyaedt-examples\\.venv\\lib\\site-packages\\matplotlib\\pyplot.py'>
Save and close the EDB#
The GDS file has been converted to an EDB and is ready for subsequent processing either in the 3D Layout UI of Electronics Desktop or using PyEDB. The following commands save and close the EDB.
[7]:
edb_path = os.path.join(temp_folder.name, "gds_design.aedb")
edb.save_as(edb_path)
edb.close()
PyEDB INFO: EDB file save time: 0.00ms
PyAEDT INFO: EDB file save time: 0.00ms
PyEDB INFO: EDB file release time: 15.63ms
PyAEDT INFO: EDB file release time: 15.63ms
[7]:
True
View the layout#
Open the EDB in Electronics Desktop#
The following command opens the EDB in Electronics Desktop. If you’re running this example locally, you should see something like this:
[8]:
h3d = Hfss3dLayout(project=edb_path, version=AEDT_VERSION, new_desktop=NG_MODE)
PyEDB INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)].
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)].
PyEDB INFO: PyAEDT version 0.18.dev0.
PyAEDT INFO: PyAEDT version 0.18.dev0.
PyEDB INFO: Initializing new Desktop session.
PyAEDT INFO: Initializing new Desktop session.
PyEDB INFO: Log on console is enabled.
PyAEDT INFO: Log on console is enabled.
PyEDB INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_6a31749b-0e56-4763-a949-fb665aa1e91f.log is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_6a31749b-0e56-4763-a949-fb665aa1e91f.log is enabled.
PyEDB INFO: Log on AEDT is disabled.
PyAEDT INFO: Log on AEDT is disabled.
PyEDB INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyEDB INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyEDB INFO: New AEDT session is starting on gRPC port 61858.
PyAEDT INFO: New AEDT session is starting on gRPC port 61858.
PyEDB INFO: Electronics Desktop started on gRPC port: 61858 after 16.62744688987732 seconds.
PyAEDT INFO: Electronics Desktop started on gRPC port: 61858 after 16.62744688987732 seconds.
PyEDB INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
PyEDB INFO: Ansoft.ElectronicsDesktop.2025.1 version started with process ID 9728.
PyAEDT INFO: Ansoft.ElectronicsDesktop.2025.1 version started with process ID 9728.
PyEDB INFO: EDB folder C:\Users\ansys\AppData\Local\Temp\tmpdnvvq0t7.ansys\gds_design.aedb has been imported to project gds_design
PyAEDT INFO: EDB folder C:\Users\ansys\AppData\Local\Temp\tmpdnvvq0t7.ansys\gds_design.aedb has been imported to project gds_design
PyEDB INFO: Active Design set to 0;IC_Wo_Component1
PyAEDT INFO: Active Design set to 0;IC_Wo_Component1
PyEDB INFO: Active Design set to 0;IC_Wo_Component1
PyAEDT INFO: Active Design set to 0;IC_Wo_Component1
PyEDB INFO: Aedt Objects correctly read
PyAEDT INFO: Aedt Objects correctly read
Close the HFSS 3D Layout#
The following command releases Ansys Electronics Desktop and closes the project.
[9]:
h3d.release_desktop()
PyEDB INFO: Desktop has been released and closed.
PyAEDT INFO: Desktop has been released and closed.
[9]:
True
Clean up#
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.
[10]:
temp_folder.cleanup()
Download this example
Download this example as a Jupyter Notebook or as a Python script.