|
1 | | -# # EDB: Importing GDS file |
| 1 | +# # GDS Import |
2 | 2 | # |
3 | | -# This example demonstrates how to import GDS files and translate their information to an EDB file. |
| 3 | +# Integrated circuit layout data is defined in GDS data which specifies the layout |
| 4 | +# geometry. Additionally, layer mapping and layer material information is defined in a |
| 5 | +# technology file. |
| 6 | +# |
| 7 | +# This example demonstrates how to import GDS files and translate GDS data |
| 8 | +# into an EDB file along with some simplified technology data |
| 9 | +# for subsequent use in HFSS 3D Layout. |
| 10 | +# |
| 11 | +# Keywords: **GDS**, **RFIC** |
4 | 12 |
|
5 | | -# Perform imports. |
| 13 | +# ## Prerequisites |
| 14 | +# |
| 15 | +# ### Perform imports |
6 | 16 |
|
7 | | -# + |
8 | 17 | import os |
9 | 18 | import tempfile |
10 | 19 | from pyedb.dotnet.edb import Edb |
11 | 20 | from pyedb.misc.downloads import download_file |
12 | 21 | from ansys.aedt.core.hfss3dlayout import Hfss3dLayout |
13 | | -# - |
14 | 22 |
|
15 | | -# ## Case 1: Import a GDS file. |
| 23 | +# ### Define constants |
| 24 | +# Constants help ensure consistency and avoid repetition throughout the example. |
| 25 | + |
| 26 | +AEDT_VERSION = "2025.1" |
| 27 | +NG_MODE = False # Open AEDT UI when it is launched. |
| 28 | + |
| 29 | +# ### Create temporary directory |
| 30 | +# |
| 31 | +# Create a temporary working directory. |
| 32 | +# The name of the working folder is stored in ``temp_folder.name``. |
| 33 | +# |
| 34 | +# > **Note:** The final cell in the notebook cleans up the temporary folder. If you want to |
| 35 | +# > retrieve the AEDT project and data, do so before executing the final cell in the notebook. |
| 36 | + |
| 37 | +temp_folder = tempfile.TemporaryDirectory(suffix=".ansys") |
| 38 | + |
| 39 | +# ### Import a GDS file. |
| 40 | +# |
| 41 | +# Download the test case folder and copy it to the working directory. The |
| 42 | +# method ``download_file()`` retrieves example data from the |
| 43 | +# [Ansys GitHub "example_data" repository](https://github.com/ansys/example-data/tree/main/pyaedt). |
16 | 44 | # |
17 | | -# Download the test case folder and copy it to a temporary folder. |
18 | 45 | # The following files are used in this example: |
19 | 46 | # |
20 | | -# - XML_Automation.xml |
21 | | -# defines physical information such |
22 | | -# as material properties, stackup layers, and boundary conditions. |
23 | | -# - Model.map |
24 | | -# maps properties to stackup layers. |
| 47 | +# - ``Model.xml`` defines physical information such |
| 48 | +# as material properties, stackup layer names, and boundary conditions. |
| 49 | +# - ``Model.gds`` contains the GDS data for the layout. |
| 50 | +# - ``Model.map`` maps properties to stackup layers. |
25 | 51 |
|
26 | 52 | # + |
27 | | -temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") |
28 | 53 | control_fn = "Model.xml" |
29 | 54 | gds_fn = "Model.gds" |
30 | 55 | layer_map = "Model.map" |
31 | 56 |
|
32 | | -local_path = download_file("gds", destination=temp_dir.name) |
33 | | -my_control_file = os.path.join(local_path, control_fn) |
34 | | -my_map_file = os.path.join(local_path, layer_map) |
| 57 | +local_path = download_file("gds", destination=temp_folder.name) |
| 58 | +control_file = os.path.join(local_path, control_fn) |
| 59 | +map_file = os.path.join(local_path, layer_map) |
35 | 60 | gds_in = os.path.join(local_path, gds_fn) |
36 | 61 | # - |
37 | 62 |
|
38 | | -# ## Open EDB |
| 63 | +# ### Open the EDB |
39 | 64 | # |
40 | | -# Import the gds and open the edb. Each gds is followed either by a control file (XML) or a technology file (IRCX, VLC.TECH, or ITF). |
41 | | -# Then a MAP file is also regularly used to map the stackup layers, and finally in some cases a layer filter (XML) is deployed, when |
| 65 | +# Each GDS file requires a control file (XML) or a technology file (IRCX, VLC.TECH, or ITF) |
| 66 | +# that maps the GDS geometry to a physical layer in the stackup. |
| 67 | +# The MAP file is also regularly used to map the stackup layers, and finally in some cases a layer filter (XML) is deployed, when |
42 | 68 | # only a part of the stackup is needed. |
| 69 | +# |
| 70 | +# Open the EDB by creating an instance of the ``Edb`` class. |
43 | 71 |
|
44 | | -# + |
45 | | -# Select EDB version (change it manually if needed, e.g. "2025.1") |
46 | | -version = "2025.1" |
47 | | -print(f"EDB version: {version}") |
48 | | - |
49 | | -edb = Edb(gds_in, edbversion=version, control_file=my_control_file, map_file=my_map_file) |
50 | | - |
51 | | -# ## Plot stackup |
| 72 | +edb = Edb(gds_in, edbversion=AEDT_VERSION, control_file=control_file, map_file=map_file) |
52 | 73 |
|
| 74 | +# ### View the layer stackup |
53 | 75 |
|
54 | 76 | edb.stackup.plot() |
55 | 77 |
|
56 | | -# ## Save and close EDB |
| 78 | +# ### Save and close the EDB |
57 | 79 | # |
58 | | -# Save the project. |
59 | | - |
60 | | -edb1_path = os.path.join(temp_dir.name, "gds_design.aedb") |
| 80 | +# The GDS file has been converted to an EDB and is ready for subsequent processing either in the |
| 81 | +# 3D Layout UI of Electronics Desktop or using |
| 82 | +# PyEDB. |
| 83 | +# The following commands save and close the EDB. |
61 | 84 |
|
62 | | -edb.save_as(edb1_path) |
| 85 | +edb_path = os.path.join(temp_folder.name, "gds_design.aedb") |
| 86 | +edb.save_as(edb_path) |
| 87 | +edb.close() |
63 | 88 |
|
64 | | -# Close the project. |
65 | | - |
66 | | -edb.close_edb() |
67 | | - |
68 | | -# ## Open both EDB files with HFSS 3D Layout, and observe the design / confirm the robustness from GDS to EDB. |
| 89 | +# ## View the layout |
| 90 | +# ### Open the EDB in Electronics Desktop |
| 91 | +# |
| 92 | +# The following command opens the EDB in Electronics Desktop. If you're running this example locally, you should see something like this: |
| 93 | +# |
| 94 | +# <img src="_static/layout.png" width="800"> |
69 | 95 |
|
70 | | -h3d_gds = Hfss3dLayout(project=edb1_path, version=version, new_desktop=True) |
| 96 | +h3d = Hfss3dLayout(project=edb_path, version=AEDT_VERSION, new_desktop=NG_MODE) |
71 | 97 |
|
72 | | -# ## Close the HFSS 3D Layout design and release the dekstop. |
| 98 | +# ### Close the HFSS 3D Layout |
| 99 | +# The following command releases Ansys Electronics Desktop and closes the project. |
73 | 100 |
|
74 | | -h3d_gds.release_desktop() |
| 101 | +h3d.release_desktop() |
75 | 102 |
|
76 | | -# Clean up the temporary folder. |
| 103 | +# ### Clean up |
| 104 | +# |
| 105 | +# All project files are saved in the folder ``temp_folder.name``. |
| 106 | +# If you've run this example as a Jupyter notebook, you |
| 107 | +# can retrieve those project files. The following cell |
| 108 | +# removes all temporary files, including the project folder. |
77 | 109 |
|
78 | | -temp_dir.cleanup() |
| 110 | +temp_folder.cleanup() |
0 commit comments